Reputation: 115
Is it possible to connect to Google Spreadsheet in GAS using SQL-type queries? If so, any working samples?
Thanks.
Upvotes: 0
Views: 4146
Reputation: 7965
Depending on what you want to do, there are two options.
1) You can have a SQL Database and connect to it using the Jdbc Service ( https://developers.google.com/apps-script/service_jdbc ).
2) The other option, which I've used once earlier, is by making use of the QUERY() function. You can set the formula on a cell to the SQL like query and then read the subsequent cells. ( https://support.google.com/docs/bin/answer.py?hl=en&answer=1388882 ).
Update after Google I/O 2012: As you might have already noticed, Google possibly heard you and introduced ScriptDB which is better than the two options mentioned
Upvotes: 6
Reputation: 940
You can also used the "Structured Query" parameters available in the Spreadsheets API to make calls like: &sq=filter:7
where filter is the name of your column and you want to return the results of any row where the value in that column is 7. See the List Feed section of the Spreadsheet API.
Upvotes: 0