Google Docs How to ? Programming tricks

How to Use Google Spreadsheet As a Database

Now Google Docs has become a very popular place to store data online. Within past few years it has gained momentum like anything. Everybody wants their data to be secure and that's what  Google Docs provide. It also gives us a very user friendly interface to deal with data. It is now fully controlled as we can set its visibility to public according to our need. Today we will learn how to use Google Sheet as a database.

How we can do it ?

Just like your database you can store large number of rows in a Google Sheet. But when you go to fetch the data, how to retrieve some selective rows from it ? Of-course we will need some query to selectively choose some rows. Fortunately Google Docs supports SQL like queries to be run on the data and get the result.

Lets take an example of a school with some students. The students have appeared the exam recently and their marks has been calculated. You want to publish their result online so that students can see their score from their home. This can be done very easily with a Google Sheet and also there is no need of any programming knowledge.

How to publish student's results online with Google Sheet

Go to Google Docs and create a spreadsheet. Store the students mark in a sheet with their name and roll number. You can see an example in the following snapshot. Then in spreadsheet go to File–>Share to change its visibility. Change it to "Anyone who has the link can view". Now you have two options to display their result. The same have been described below.


Display their score in an iframe

Display their score in a popup Window

What needs to be modified ?

Just you need to change the key with your own key. Another point to remember is, always keep the Roll number as the first column in the spreadsheet.