I have a query to a google sheet that is working as I expect. I'm using Postman to do my testing because in my app — which is a desktop app, I cannot use any of the SDKs that Google provides. This is not a web app, so I cannot use even Javascript source that is hosted on Google's CDN. In any case, I'm querying a spreadsheet that has many rows, with a particular column that I'm querying for:
I'm using the following endpoint, after having retrieved an authentication token via OAuth2 methodology:
https://docs.google.com/a/google.com/spreadsheets/d/{{sheet_key}}/gviz/tq?sheet={{tab_name}}&tq={{sheet_query}}
The {{sheet_query}} variable in Postman, which handles the URL encoding properly is set to the following:
select * where C = 'ready'
The response for my particular worksheet is what I would expect and the data is correct. There are three rows in the sheet where column C is set to 'ready' which is great.
Now, the response to this GET request does not appear to send back the ordinal row index for the retrieved rows, it just send the rows' data. The problem is that I want to write back to these rows via the Google Sheets API v4 which now uses the A1 notation as a method to target which cell range to update.
The problem is that in order to write back to these rows retrieved via my Visualization API request, I would need the rows' ordinal indices for the requests to the Google Sheets API. Is there any way to get each row's ordinal index from the Sheet in the request to the Visualization API call?
I found this Stack Overflow thread, but I'm not exactly sure if this can work in my case as I'm essentially building the requests manually and without an SDK. I'm also not using Google Apps Script, I'm using the Visualization API. The only workaround I can think of is to force the end-user to ensure the worksheet to be queried has a column whose cells have the =ROW()
formula, but I would rather not make that a requirement on the user's part.
Any insights or guidance is appreciated.
I'm also not using Google Apps Script
. So if you cannot use Google Apps Script for your situation, I apologize. – Tanaike