Google sheet embed URL documentation

2019-03-08 16:32发布

问题:

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).

回答1:

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)
gid=24 (Whis sheet you want to display)
widget=false
single=true
range=A2:AA26 Output=html
widget=false
width=(width)
height=(height)
frameborder=(size of border)
q=(Whatever) Search Query
viewer?
start=
channel=
ibd=
client=


回答2:

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