HOW TO use a Google Spreadsheet as a read-only database for a web app

The data in a Google Spreadsheet can be accessed in JSON and JSONP format through a URL.  The trick is to extract the key from a spreadsheet's URL (the key looks something like this - 0AtMEoZDi5-pedElCS1lrVnp0Yk1vbFdPaUlOc3F3a2c) and place it in the position indicated in the below URL:

https://spreadsheets.google.com/feeds/list/KEY/od6/public/values?alt=json-in-script&callback= 

This approach can be useful when a limited number of people manage a database but when it has to be publicly viewed by users of a website. You can even use Google Spreadsheet formulas (like ImportXML()) to create dynamic values for a column.

So if you have data in a Google Spreadsheet whose schema is defined by the names in the first row,
it is possible to get that data as a JSON feed
and use it to programmatically display the list on a web page

Retrieving a feed without authentication is only supported for published spreadsheets.

On a related note - Microsoft too has an API that allows reading and writing to cells in Excel Web App via a JavaScript library. However, this code needs to be running in an "App for Excel" which is embedded in the Excel document. An Office 365 SharePoint List can also be queried via OData/REST calls.

Also see:
Show off your book collection with this AngularJS script & Google Spreadsheet
Search all your ebooks with a keyword by putting them on Google Drive
Simple example of retrieving JSON feeds from Spreadsheets Data API
Using IFTTT and Google Drive to create a JSON API

Comments