Random Tables

What is this?

Random Tables is a Google Doc Add-on that calls a function in a Google Sheet and writes the result into the document.

Random Tables came out of an exploration of solo tabletop RPG. With the absense of a GM, the soloist takes on activities of both player and GM.

To aid in the GM side of things, a soloist can use random tables. The soloist roles a die, like a d20, and uses the result to reference a table whose entries are numbered, in this case 1 to 20.

Perhaps this table has entries of magicial items, rolled when opening a chest. Or perhaps the table has entries of monster encounters, rolled when proceeding through a wilderness.

The soloist often records the experience as a narrative in a document or journal. The narrative can be as descriptive or as prosy as the soloist desires, enough to express the events of the adventure.

A popular solo tabletop RPG is Ironsworn, by Shawn Tomkin. Many players use Google Docs to journal their adventures.

Google Sheets is a natural fit for storing and working with tables.

I saw an opportunity to combine the adventure journal in Google Docs with the automation the rolling of random tables in Google Sheets.

The middleware connecting the two is Google App Script.

What does this do?

When this Add-on is loaded in a Google Doc, Random Tables appears under the Add-ons menu. A Show sidebar option appears under the Random Tables Add-on menu. In the sidebar, use the load control to load a Google Sheet from a URL. The Google Sheet must follow a specific format. The sidebar will be populated with buttons that call functions (random tables) in the Google Sheet, and write the result into the document.

Examples of buttons are:

  1. Roll d20 - return random a number between 1 and 20

  2. Roll d6 - return random a number between 1 and 6

  3. Roll Treasure - return a random row from the Treasure table

  4. Oracle Roll - return the answer to a Yes/No question from the Oracle table

Google Sheets is a very powerful tool, and not every function needs to employ a table. For example, the Roll d20 button can use the RANDBETWEEN() Google Sheet function to generate a random number.

These functions may take input from the user. If an input is defined for the function, the button will prompt the user with a dialog. Google Sheet data validation for range and for list are supported and are rendered as a dropdown lists in the dialog.

More Information

For more information, see the GitHub page.