1
votes

I want to fetch JSON from google spreadsheet, I searched few links but cannot find the exact solution.

Can someone help me with the solution.

https://developers.google.com/gdata/docs/json
http://www.mail-archive.com/[email protected]/msg01924.html
http://code.google.com/apis/gdata/docs/js.html
http://code.google.com/apis/spreadsheets/gadgets/
http://code.google.com/apis/documents/docs/3.0developers_guide_protocol.html#UploadingDocs

Regards
Anup Singh

2
What specifically are you unsure about? And you'll need to accept some more answers to previous questions if you want people to continue to help you. - Daniel Roseman

2 Answers

2
votes

A little late but here's the workflow:

See the answer here for proper OAuth authorization if your spreadsheet is private.

Your spreadsheet key can be found by going to Google Drive and looking at your spreadsheet. In the url is the string "key=xxxx". The 'xxxx' is your Spreadsheet key.

Then merely do the following:

var token = gapi.auth.getToken().access_token;
var urlLocation = ''; //put the spreadsheet key here
var url = 'https://spreadsheets.google.com/feeds/list/' + urlLocation + '/od6/private/full?alt=json-in-script&access_token=' + token + '&callback=?';

$.getJSON(url, function(data) {
    console.log(data);
});
1
votes

https://developers.google.com/gdata/samples/spreadsheet_sample

here is an example.

Note this JSON only works for "published" spreadsheets.