How to Post Tables


Meta chat about running/playing PBP games

User avatar

Posts: 16132

Joined: Thu Sep 05, 2013 1:15 am

Location: Melbourne, Australia

Post Thu Jan 15, 2015 10:08 pm

How to Post Tables

There are two principal ways to post tables on this board:

1) As monospaced text, or
2) As an embedded spreadsheet.

The first method is super easy and good for trivial tables that you don't expect to change much. The second method is more involved but is good for large or complex tables that can change over time.

Here's how to post both:


Monospaced Text Tables

With this method you type up your table in any text editing tool that supports a mono-spaced font, ensuring that the rows and columns line up as you want them to appear. Then copy and paste your table text into the post form and enclose it within CODE tags. E.g., if you were to post this (using square brackets rather than curly braces for the CODE tags):

{code}
Level | Title
------+----------
1 | Fighter
2 | Veteran
3 | Myrmidon
4 | Hero
{/code}

The board would render it like this:

  Code:
Level | Title   
------+----------
  1   | Fighter 
  2   | Veteran 
  3   | Myrmidon
  4   | Hero   

Super easy!


Embedded Spreadsheets

If you want a more complex table with lots of data, internal calculations, or frequent updates (such as an ongoing summary of PCs statistics) then an embedded spreadsheet is the way to go.

The board assumes we'll be using Google Sheets; it's free, it runs in your browser, and it works today. (If you desperately need to use a different tool PM me and we'll work something out).

So the steps would be:

1. If you don't already have Google Sheets, add it to your browser.
2. Using Google Sheets in your browser, create whatever spreadsheet you need.
3. Still using Google Sheets in your browser, publish the part of your spreadsheet you want to embed in your post (see here). This will give you a URL.
4. Now comes the tricky part.

The URL which Google Sheets has generated will look like this:

h t t p s ://docs.google.com/spreadsheet/pub?key={IDENTIFIER1}&single=true&gid=0&range={IDENTIFIER2}:{IDENTIFIER3}&output=html

In order to embed the (now published) spreadsheet in a post you need to copy whatever text appears for IDENTIFIER1, IDENTIFIER2, and IDENTIFIER3 from the URL, and paste it into this board's GSHEET tag, like this (using square brackets rather than curly braces for the GSHEET tags):

{gsheet}0AsikuKGxbESzdFJOU0QyOUk4VTEwaV9pTGstM0xMRnc#B3:J38{/gsheet}

The board will render the above GSHEET tag like this:



Spreadsheets are generally easier to edit (than HTML-type table tags), more powerful (they do calculations inline), and also: your published Google Sheet is requested every time the containing post is rendered, so any updates to your Google Sheet will automatically appear in the embedded spreadsheet here, next time it is drawn.
[f=32]Golgildir the Elf Medium (MV 12", AC 9, HD 1, hp 1/1, AL N) great cloak, lantern; spells: color spray; scrolls: sleep, sleep, charm person
Hirelings: Georges; torch[/f]
User avatar

Posts: 744

Joined: Thu Jan 08, 2015 7:53 pm

Post Thu Jan 15, 2015 10:24 pm

Re: How to Post Tables

Google generated this for me

https://docs.google.com/spreadsheets/d/ ... _M/pubhtml

Any idea how to parse that one?
User avatar

Posts: 16132

Joined: Thu Sep 05, 2013 1:15 am

Location: Melbourne, Australia

Post Thu Jan 15, 2015 11:00 pm

Re: How to Post Tables

Makofan wrote:Google generated this for me

https://docs.google.com/spreadsheets/d/ ... _M/pubhtml

Any idea how to parse that one?


It looks like you've published the whole sheet rather than an explicit cell range.
Never mind, let's "guess" at a cell range; suppose you wanted the cell range A1 to M20. Then

IDENTIFIER1=1tg2xNYN0pPN83uS_g4sTankO57gECXYCXBXsoJO_8_M
IDENTIFIER2=A1
IDENTIFIER3=M20

So your whole GSHEET tag should look like this:
{gsheet}1tg2xNYN0pPN83uS_g4sTankO57gECXYCXBXsoJO_8_M#A1:M20{/gsheet}

Which will be rendered like this:
[f=32]Golgildir the Elf Medium (MV 12", AC 9, HD 1, hp 1/1, AL N) great cloak, lantern; spells: color spray; scrolls: sleep, sleep, charm person
Hirelings: Georges; torch[/f]
User avatar

Posts: 744

Joined: Thu Jan 08, 2015 7:53 pm

Post Fri Jan 16, 2015 1:21 am

Re: How to Post Tables

Ah, thanks. Reading comprehension 101!

Return to How To PBP

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software