Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheets retrieving JSON feed

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?

like image 362
Tony Ranieri Avatar asked Mar 21 '23 00:03

Tony Ranieri


1 Answers

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

like image 170
Vlad Lego Avatar answered Mar 23 '23 19:03

Vlad Lego