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.
simply awesome….
nice post..
This is some great code. However, I’m trying to use it to look up names and I can’t figure out how to get the search to accept characters/string instead of a number. Is there anyway to modify the code anywhere to change this?
Yes, Emily you can obviously do that using like operator in the URL. Here is the example. You can see in the URL I am searching for Hari. Replace it with other names to view others.
I know this is old post but code works well except won’t find text string only numbers. How to search text without putting your search text directly into URL i.e. still using input form to enter a search term “abcdef” and have data retrieved? Thanks
Hi, great work!, i´m wondering about two things: 1. How I can start whitout show all data at open the page. And 2. How I can show the content of only one file but reorganizing all cells, for example if I need to print or expotr to a pdf, thanks for your help.
Not clear, what you exactly want. Please elaborate your question. You want to export to PDF ?
Sorry fo my bad english, I need to show in a web page the content of only a row but I need to organize all cells like a table, like this: https://docs.google.com/spreadsheet/ccc?key=0AhED2RM-hSyCdEtMOVRkZG9xTlRkT3l6Z0gwR1VPRkE&usp=drive_web#gid=0, the first table has all data row by row, all next tables have all data of only a row but organized to be data reading more friendly, thanks for your help.