Using Google Spreadsheets as a Database in the Cloud

(My Original Blog Post: -*

Attention! API Garbage (might be unreadable):

spreadsheets data spreadsheet

Work with spreadsheets API might already be familiar with Google spreadsheets all in spreadsheets application that allows for real-time collaboration is part of our Google docs we ve spreadsheets API allows you to programmatically access and modify your spreadsheet data in your language of choice Google provides client libraries in a variety of languages which simplify working with the spreadsheets API I ve recently made an addition to the Python library that makes it easier to use spreadsheets as a simple text database one of the great things about using Google spreadsheets is a simple database is that you can see and modify all of your data from a nice user interface in your data is available on a machine is larger connected to the Internet you can interact with the data in your Google document s let s could start first off the Python client libraries open source and available at data — Python — client this module is called text DB and it lives within the G-8 a spreadsheet package of the G-8 a client library the spreadsheet module allows you to use all the features in the spreadsheets API and the new text DB module is built on top of it the text DB module streamlines a specific use case and makes using the spreadsheets API feel like using a simple database is much more that you can do with the spreadsheets API like use formulas on data from other sources and update a large number of cells at once but I decided to make this module about ease-of-use lets take a look at a sample of how to use the text in the module will begin by importing the module which has classes that make it easy use Google spreadsheets like a simple database and excellent porta demo module which enters my e-mail address for me so that s not broadcast to the world thanks to this video that we can create a new Google spreadsheet using our client is easy all you need to provide his name the database object represents our new Google spreadsheet and were ready to create a table of first let s take a look at this document in toolbox okay let s say that we have a table of nights and want to ask their name quest and favorite color are spreadsheet now has a new worksheet and were ready to add some information in the open now and will see a new row appear and are spreadsheet which also at information through the spreadsheets user interface for working with existing data we may need to start by finding the spreadsheet which you can do by looking up the name of the spreadsheet or the unique spreadsheet Key ID since you can have multiple spreadsheets with the same name to get databases method returns a list you can retrieve rows of data in several ways you can look up a single row or request a range of rows using get records since we only have three rows of data rows contains three items you can also search for roast which match certain requirements using spreadsheet structured query language structured queries can contain and were less than greater than exact matches and not equals we had two nights with the favorite color of blue so as you can see we have two matches once we have a rows we can make changes to the data in our Google spreadsheet one of the potential challenges and storing your data in the cloud is it read and write operations may be slow because they re transferring data or slow and potentially flaky network connections to avoid this problem in the text DB library changes to local objects are only sent to the server when you call the push method in our example earlier we forgot xb7 hats cost let s do that now let s take a look at the content and the record now we re going to send this change to the server and we should see the quests in our spreadsheet update I also see that we got Galahad s favorite color wrong to shore treating updates which it happened outside of local copy of the data will make a change in the spreadsheet or local copy doesn t have the change yet but after Republican you can see that the content has been updated I just want you through a simple example of using the text DB module to use Google spreadsheets as if it were database and the cloud this is just one of the ways that you can use the spreadsheets API and although this example is in Python a similar library could be built in almost any language all the code that I ve used in the sample is open source to your free copy it and modify it as you like if you think of some other interesting things that you d like to do using the spreadsheets API would love to hear about it please visit us in the Google docs data API group you can also check out the documentation for the API on


~ by bitahatini on December 15, 2008.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: