If you try to save form data to Google Spreadsheets and you have more than one worksheets, soon enough you’ll run into this issue trying to figure out how to get the id of the worksheet you need to update. While I don’t know how to obtain this id programmatically, there’s a practical way to do it and it should only take about a minute of your time.
Using the simple Sheet 23 in this Registration GDocs as an illustration, it’s obviously not the first and the only worksheet within the Google spreadsheet.
The first thing you need to do is just go to the File from the menu and select Publish to the Web…
On the new screen that pops out, just follow these 4 steps as pictured below.
- Select the sheet you want to obtain the id
- Click on Start publishing button
- Select either ATOM (recommended) or RSS from the Get a link to the published data option
- If you choose ATOM, the link should come out in this format:
http://spreadsheets.google.com/feeds/list/[spreadsheet key]/[worksheet id]/public/values
Copy down the worksheet id from the provided link in circle. In this case, it’s the “ocz” but it may be different on yours (e.g., od4, od6, od8, and et cetera).
Unless you want to publish your worksheet now, you need to make sure you click back the Stop publishing button.
Click Close and you’re done.
Further Reading
Getting Started with the Google Data PHP Client Library
Google Data Protocol
Saving Form Data to Google Spreadsheets Using PHP and the Google Docs API
Zend Gdata Library Downloads
This technique appears to be obsolete.