Use Google Sheet as a free online database for prototyping


I really like prototyping, since I can quickly show a clickable version of an idea that’s floating around my head. But the pain of setting up an environment for that is sometimes too expensive and less attractive. Recently I found a cheap way to using a database that I wanted to share.

Google Drive is a great way of keeping a virtual collection of documents. I especially appreciate small incentives like them offering a dashboard with the online status of each service, and we can easily see that it’s quite a reliable solution for most needs. Another (less popular) use of Google documents is that of an online database to feed data to other applications. I was very happy to discover it has quite a bit of support for the Sheets by having an API exposed.

An added cool factor is the fact that we can access data as json to adding alt=json in the URL query params. And it gets even better, we can also pass a callback by adding alt=json-in-script&callback=handcraftedCallback to have data wrapped to handcraftedCallback.

Some basic things we should note in the setup are the permissions.
For this example I’ve set up a harmless spreadsheet to toy around with.
On the first attempt to access it via this URL
https://spreadsheets.google.com/feeds/list/1YNiISzk3b1emyeNI4TRt58Q0Ni1Librq087anSy64Pk/1/public/values?alt=json-in-script&callback=handcraftedCallback the response will be an error saying “We’re sorry. This document is not published.”

This needs us to publish the document to web.
publish-to-web-menu

After we access the dialog screen,

publish-to-web-button
then we click “Start publishing”,

publish-to-web-published
then we confirm our choice in the dialog.