Reputation: 9037
I would like to append data from pandas to google sheets using google sheets api. checking the document, it require parameter range. so far I set the max possible value in google sheets, see similar post how to set cells range dynamically in Google sheets. but it does not solve my question. so anyway I can use dynamically?
batch_update_spreadsheet_request_body = {
'majorDimension': 'ROWS',
'values': df.values.tolist(),
}
response = service.spreadsheets().values().append(spreadsheetId=google_sheets_id, valueInputOption='RAW', body=batch_update_spreadsheet_request_body, range='A1:AA1000').execute()
Upvotes: 0
Views: 706
Reputation: 50462
As written in the documentation,
When appending values, this field represents the range to search for a table, after which values will be appended.
So, You only need to add the left top cell range of the table you're trying to append to.
Upvotes: 1