Reputation: 526
I want to send an SQL query to Google Sheets REST API, which returns JSON for values, instead of HTML or JSONP(text)
The API i am talking about is this: https://developers.google.com/sheets/api/reference/rest/
But i cannot see any Reference for giving SQL query as part of the API. Is this not possible?
Google Sheets does allow to process SQL query but it is giving me only HTML or some text based JSONP data back, instead of pure json.
The endpoint i am using is this:
GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}
Upvotes: 1
Views: 7956
Reputation: 11167
Check out my SO answer to another question which may contain what you're seeking — https://stackoverflow.com/a/37868852/305689 — be sure to read the actual question above, esp. the tail end of it.
I didn't mention this in the other answer, but the response defaults to JSON, however you can also select HTML or CSV with the tqx
variable. See this page in the docs.
Also, I don't believe it works with the spreadsheets.readonly scope yet, so if you do this, read these authorization instructions.
Upvotes: 1