4
votes

I recently started using the "New Google Sheets" (spreadsheets) and they changed the URL to a shared public spreadsheet and I am unsure how to obtain a JSON feed of the spreadsheet data.

Based on data from this URL: https://developers.google.com/gdata/samples/spreadsheet_sample

I can obtain the JSON data from an older version spreadsheet using the key parameter found in a URL of this format: http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc

However, the new sheets have a URL like this: https://docs.google.com/spreadsheets/d/SOME-IDENTIFIER/pubhtml

Using "SOME-IDENTIFIER" in place of the key does not work, I'm not sure how I can pull the JSON feed from a new spreadsheet... Anyone have any experience with this?

2

2 Answers

4
votes

The format you should use is this :

https://spreadsheets.google.com/feeds/cells/
SHEET-IDENTIFIER/
SHEET_INDEX/
public/basic?alt=json-in-script&callback=JSON_CALLBACK

You can find SHEET_INDEX by looking at the end of the URL while editing the sheet.

...SHEET-IDENTIFIER/edit#gid=SHEET_INDEX

Make sure the spreadsheet is published (not only shared).
File/Pulish to the web...

3
votes

I tried Vlad's answer and it didn't work; the editing url had gid=0, but in order to get the feed I wanted I had to put in 1 as the sheet index.