1

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

1
  • 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. Commented Jun 8, 2012 at 12:14

2 Answers 2

2

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);
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this, it finished the start of the solution I found in the Google Docs where you had to get the gapi token set up with the rights scopes (spreadsheets.google.com/feeds) etc. developers.google.com/api-client-library/javascript/features/…
1

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

here is an example.

Note this JSON only works for "published" spreadsheets.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.