36
votes

Does anyone know if there is any official documentation for google spreadsheet embed URL paramaters?

That is, given an embed URL from Google Sheets like this: https://docs.google.com/a/aicr.org/spreadsheet/pub?key=0AhExuVBhVYT1dGxxejBmUHAzYUhGb25veTRkdW1YekE&single=true&gid=1&output=html&gridlines=false

  1. What do the arguments do, and
  2. What other arguments are available, that aren't included by default?

After much digging and searching, I have found:

  • Some parameters don't seem to do anything (&single=true, &embedded=true)
  • Some parameters are declared confidently in google search results, but don't work (&gridlines=false)
  • Some parameters don't seem to appear in any searches I have done (&output=csv)

... and no search I have done has produced anything even remotely approaching either of:

  • an official, google-maintained document for embed URLs
  • a code view of the code that is used to parse the embed URLs

By trial and error I have found:

  • &key=[ID]
    • google sheet ID
  • &single=[true|false]
    • true: ??? (present when I have published only a single sheet)
    • false: ???
  • &gid=[#]
    • sheet ID ??? (present when I have published only a single sheet)
    • perhaps this can be used to specify a sheet and range when your entire google sheets doc has been 'published to the web' (instead of just one sheet from your doc)
  • &range=[CellAddress1:CellAddress2]
    • specify a range of cells to include, eg "B1:C20"
    • if 'widget=' is false or not present, suppresses display of the usual google header & footer info
    • if the range spacified is larger than the published sheet, displays only the sheet while still suppressing the header and footer.
  • &embedded=[true|false]
    • true: ???
    • false: ???
    • this item is included in the embed code offered from within google sheets (set to "true"), but doesn't seem to have any effect.
  • &widget=[true|false]
    • true: display entire shared item. Overrides "range=". Does NOT include the google disclaimer footer.
    • false: include google disclaimer footer in output (unless 'range=' is also present)
  • &output=[html|txt|csv]
    • html (default): output as an html table within code that also includes Google tracking code
    • txt: output the content of the specified range or sheet as tab separated text
    • csv: output as csv
  • &gridlines=[???]
    • this apparently used to work but doesn't work for me.
    • To suppress gridlines in embedded sheets I set borders on all cells, then color the borders to match the sheet's background color (eg solid white borders on a white-background sheet).
2
it looks like "range" doesn't work when exporting to .xlsx. Only .csvVictor --------
How are you specifying 'export to .xlsx'? This post is about documenting the URL parameters that can be used when embedding a google sheet into a web page.mmccarn
Sorry, I should be more specific. The "range" parameter doesn't work when using it with the "format" parameter to export a sheet as .xlsx. No matter what range is specified, it exports the entire sheet. It works when exporting as .csv though. Here's an example: yourspreadsheetURL/export?format=xlsx&range=A2:ANVictor --------

2 Answers

20
votes

Here are some of the parameters I found for Google Docs (thanks goes to Joel http://obstruction.tumblr.com/post/60784440737/google-docs-url-parameters-rm-minimal-rm-full):

Google Docs URL parameters:

rm=minimal
rm=full
rm=embedded
rm=demo
rm=(render mode)

ui=2 (select the interface version)
chrome=false (full screen mode)
frameborder=(size of border)
q=(Whatever) Search Query

gid=24 (Which sheet you want to display)
widget=false
single=true
range=A2:AA26 Output=html
format=(export spreadsheet)
format=xlsx
format=csv

widget=false
width=(width)
height=(height)
viewer?
start=
channel=
ibd=
client=
3
votes

I've been looking for the same thing! One more URL parameter I have found useful is

  • &rm=[minimal|?]
    • minimal: hides the top menu and cell inspector, but still shows row numbers, column letters, and the Add More Rows feature at the bottom.

This resource describes some of the parameters, though I can't vouch for its accuracy. http://www.goopal.org/google-sites-business/google-spreadsheets/spreadsheet-output/publish-spreadsheet#TOC-Other-Export-Parameters