Search code examples
google-docs-apigoogle-sheets-api

Query data from Google Spreadsheet generated by Form


Currently we're having a request to integrate the Google Form functionality into our system. I'd done some searching on the web, and found that there's no way we can change the post processing of a Google Form unless we do some heavy customization using 3rd party tools.

Thus i have an idea that, when someone fill in the Google Form, he/she will need to fill in a 'user id' in the form. This will be collected as a field in the Google Spreadsheet generated by the form.

In my back end application, i would query the spreadsheet and look for the user id field input by the user. Then i would be able to know whether he/she completed the form or not.

I'm trying to look at the Google Docs API for the spreadsheet and found that there are list-based feed and cell-based feed but i'm not sure which one can achieve what i want to do. Anyone has experience in this can shed a light?

Thank you


Solution

  • Think of a list based feed as being like SQL. You can read rows, insert rows(at the bottom), delete rows and update rows. - you can only store data, not formulas. In contrast, A CELL based feed lets you read and write to cells, any cell, using the cell reference (R1C1 style). CELL FEED give you more control, and includes batch updates.

    some sample CELL FEED code is here: http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/spreadsheet/cell/CellDemo.java?r=51

    Another option is too use google apps script, this is maybe less work if you just want to extract data. The html service is probably the tool for the job https://developers.google.com/apps-script/html_service - as you can dont need OAuth to do the read.