Google gadget/spreadsheet: Grab spreadsheet key for gadget
-
19-09-2019 - |
Question
So I'm working on a google gadget(really only gadgetizing so I can get a datastore for this) that I want to be embeddable in a google spreadsheet (after this point, I'm going to skip the word google - you can just imagine it's there).
I want to use the spreadsheet that I embed the gadget in as a key/value store for the data I enter within the gadget (I think the 2K limit for gadget data won't be enough). It looks like what I'll want to do is use the gadget's feed api to manipulate the spreadsheet's list feed. However, in order to know what the spreadsheet's list feed is, I need to know the key for the spreadsheet (which is in the URL). I don't think I can scrape the key directly from the URL, since the gadget seems to be inserted via iframe.
So I need to know how I can tell a gadget that I'm embedding in a spreadsheet the key for that spreadsheet. I suppose I could have the user enter it manually, but I'd much rather have my gadget know the key programmatically.
Solution
You might want to try using Google Apps Script instead of a gadget. It is aware of the spreadsheet it is embedded on.
OTHER TIPS
You should be able to retrieve a list of spreadsheets by making a GET request to this URL:
https://spreadsheets.google.com/feeds/spreadsheets/private/full
See Google Spreadsheets API for more details: http://code.google.com/apis/spreadsheets/data/3.0/developers_guide_protocol.html#ListingSpreadsheets