I'm using the Google Sheets API quickstart for Python. I'm trying to pull multiple cells, just one cell at a time, from the google sheets api and plug each value into a text document. I've been doing this with spreadsheets().values().get()
, but I'm hitting the API too much and the batchGet()
method seems like it would be better. I read through the Google Sheets API v4 but was unable to find the correct formatting for the ranges
parameter on spreadsheets().values().batchGet()
. According to the docs, it appears that it takes an array of strings, or possibly a JSON object, but there's no example of the format in the docs (In fact, it says // TODO
!). Does anyone know the correct format? I've tried:
spreadsheetId = 098217340987123049817235blahblahblah
ranges = ["A100:A100, "B100:B100"]
spreadsheets().values().batchGet(spreadsheetId=spreadsheetId, ranges=ranges)
and
spreadsheetId = 098217340987123049817235blahblahblah
ranges = ["A100:A100"]
spreadsheets().values().batchGet(spreadsheetId=spreadsheetId, ranges=ranges)
and just a string to be sure
spreadsheetId = 098217340987123049817235blahblahblah
ranges = "A100:A100"
spreadsheets().values().batchGet(spreadsheetId=spreadsheetId, ranges=ranges)
Each of these returns []
.
When I use spreadsheets().values().get()
and ranges="A100:A100
, function returns [['cellvalue']]
, so I know there's data there.
Any thoughts?