Embed editable Google Docs spreadsheet without hea

2020-02-02 11:23发布

问题:

I have the requirement to embed a Google Docs spreadsheet on a webpage, but it needs to be just the editable cells, without the Google navigation and toolbar at the top.

I can't find a reference to the querystring variables for embedding Google docs anywhere but it seems that the only thing which removes the toolbar etc is by adding 'output=html' to the querystring. However, this is what seems to be converting it from an editable spreadsheet to a non-editable spreadsheet too, which is the problem.

Can anyone suggest how to manipulate the URL below to produce an editable document with only the cells visible (no toolbar)?

https://docs.google.com/spreadsheet/ccc?key=0AngcQK0IFROwdHZySkUwd0JtY0N6Zk5RaTAyZDFVekE&widget=true

Note, this URL doesn't work - it's just an example.

Thanks!

回答1:

Try adding rm=minimal as in:
https://docs.google.com/spreadsheet/ccc?key=0AngcQK0IFROwdHZySkUwd0JtY0N6Zk5RaTAyZDFVekE&rm=minimal



回答2:

The answer provided by Henrique requires a slight adjustment to work with the new Sheets.

Add ?rm=minimal to the end of your document's URL, i.e.

https://docs.google.com/spreadsheets/d/1zHZdAImcjI4gAy5ATBA0rSImYUowL4HC8h-vvYOdpfA/edit?rm=minimal



回答3:

Try these:-

single – setting to true displays just one sheet in the spreadsheet. The default sheet it will display is the first one created in the spreadsheet. This can be changed using ‘gid’ below.

gid – this needs to be a numeric identifier of the sheet you want to display. The first sheet created is 0, but others will have longer identifiers. To find the ‘gid’ for the sheet you want to display, go to the spreadsheet in Google Apps itself, and click on to your desired sheet. The URL in your browser should change to something like this: https://docs.google.com/a/mycompany.com/spreadsheets/d /15B___SOYjsRmU9tiwZly318HZnFHOHeayS6UTHx7Pu2I/edit#gid=419657423

The bit at the end of the URL shows you the ‘gid’ for the sheet, and that is the number you need to bring into the shortcode in your website.

range – set this to the cell range you want to display within the sheet (or leave it out to display the whole sheet). In our example, we set this to f2:g6. Note if you’re being pedantic then you should really change the ‘:’ to ‘%3A’ since colons should be encoded in URLs – but most browsers should understand the colon, so don’t worry. If you like to be correct, you’d use range=f2%3Ag6 instead.

headers=false - Row numbers and column letters are not displayed.

widget – setting this to false removes the sheet selector bar when it’s embedded.

chrome – setting this to false removes the title bar showing the spreadsheet name, above the sheet.

So putting all together:-

iframe src="https://docs.google.com/spreadsheets/d/[Googlekey]/pubhtml?gid=28&range=a1:s45&single=true&widget=true&headers=false"

Allan



回答4:

This works:

https://docs.google.com/spreadsheets/d/1MEdbr8WA.../edit?rm=minimal#gid=0

Don't forget to include the /edit? part before rm=minimal.

(The sheet has to be shared as Access:Anyone (no sign-in required) with Can edit option selected → Public on the web - Anyone on the Internet can find and edit)



回答5:

Well, as of Sept 2018 and on a privately shared (lengthy URL, but no password, easily testable in a private browser window), you have at least these 2 options:

    https://docs.google.com/spreadsheets/d/[hash]/edit#gid=0

Which gets you all the header crud. Even on a read-only share. (you can leave out the /edit#gid=0 part, but it will be added again)

    https://docs.google.com/spreadsheets/d/[hash]/htmlview

Which leaves out all of the header crud: