Google doc/sheet op website

  1. Open een bestand in Google Documenten, Spreadsheets of Presentaties.
  2. Klik bovenaan op Bestand en vervolgens Publiceren op internet.
  3. Klik op Insluiten in het venster dat wordt geopend.
  4. Het hele bestand wordt gepubliceerd, maar sommige bestandstypen hebben aanvullende publicatieopties:
    • Spreadsheet: Kies of je de hele spreadsheet of alleen bepaalde bladen wilt publiceren.
    • Presentatie: Kies de grootte van de presentatie en hoe snel je de dia’s wilt afspelen.
  5. Klik op Publiceren.
  6. Kopieer de code in het tekstvak en plak deze in je website of blog.

Spreadsheets insluiten

Als je een spreadsheet insluit, kun je ervoor kiezen bepaalde delen van de spreadsheet weer te geven of juist te verbergen. Dit kun je doen door de onderstaande parameters te wijzigen of toe te voegen.

  • gid=1674242611 – Dit is de blad-ID.
  • range=A1:B14 – Het bereik dat je wilt weergeven.
  • widget=false – Als ‘false’ is ingesteld, wordt er onderaan geen bladtab weergegeven.
  • headers=false – Rijnummers en kolomletters worden niet weergegeven.
  • chrome=false – Titel en voettekst worden niet weergegeven.

Explaining the parameters
In our modified url, after the ‘?’ you can see a series of parameter names with their value set after a ‘=’. Each parameter/value pair is separated by a ‘&’, like this (but without spaces):

? single=true & gid=419657423 & range=f2:g6 & widget=false & chrome=false

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

Security

As always, you need to consider the sharing settings of your Google Spreadsheet so that it can embed correctly while ensuring only the right users have access. Setting sharing to ‘Anyone with the link can view’ is easiest, allowing all visitors to view the spreadsheet without having to be logged into a Google account. Or you can share with specific users to ensure only they can see it, even if the link is shared outside your company.
Crucially, remember that hiding sheets or cells using the parameters described in this article will not prevent your viewers from being able to view them if they want to. They could simply remove your parameters from the URL and enter it into a different window.
 

Comments are closed.