Using Google Spreadsheets as a JSON endpoint

Google Spreadsheets can be used as a JSON endpoint. This API is not very well documented by Google, and using it involves digging unique tab IDs manually, so I created this document to make it straight-forward for anyone.

This document is curated by @codeclown. Google and relevant names and stuff are trademarked, yadda yadda, I don't own them and have no affiliation with them.

Hosted on GitHub.

Be aware that there are many resources available for working with Google Spreadsheets in JavaScript. This document describes the simple method for when you just want to fetch plain data with no external dependencies.


Step 1: Publish your Spreadsheet

Open your Spreadsheet and find Publish to the web from the File menu.

Click the blue Publish-button and you'll get a URL to copy.


Step 2: Fetch JSON URLs

Paste that URL here and submit the form:


Notes

JSONP is also supported. Just append &callback=foo.

For XML, remove ?alt=json-in-script.

This tool is completely client-side. Your Spreadsheet information is not sent to nor stored on any server.

View the source to learn how the URLs are fetched.

Note that incorrect formatting causes the API to return an empty JSON set. Do not leave empty rows in the Spreadsheet. Example of properly formatted content: