google spreadsheet api json xml html

It is not that straight forward to get the xml/json/html outpt for  a google spreadsheet. 

 

HTML

First thing we need to do is to publish the sheet under File -> publish to the web….

Here is what you may get
https://docs.google.com/spreadsheets/d/YOUR-SHEET_ID/pubhtml

Now you have the html version. 

XML/JSON 

After you get the shee-id, what you need to do is to find the grid id of the sheet use: 

https://spreadsheets.google.com/feeds/worksheets/YOUR-SHEET_ID/public/basic

After open the above URL, we get a summary of the published sheet. Then we can find the grid id under the entry element:

<id>https://spreadsheets.google.com/feeds/worksheets/YOUR-SHEET_ID/public/basic/GRID-ID</id>

Now using the combination of  GRID-ID and YOUR-SHEET_ID, we should be able to get the xml/json output by:

XML —->   http://spreadsheets.google.com/feeds/list/YOUR-SHEET_ID/GRID-ID/public/values

JOSN —->  http://spreadsheets.google.com/feeds/list/YOUR-SHEET_ID/GRID-ID/public/values?alt=json-in-script

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s