I tried three different ways to update values of a google sheets, but none of them works, I went through the pygsheet docs but I still can't find a solution to it.
import pandas as pd
import pygsheets as pyg
gc=pyg.authorize(service_account_file=r'C:\Users\mingyu\Downloads\heroic-icon-311506-93b9b87f2fed.json')
sht=gc.open_by_url('https://docs.google.com/spreadsheets/d/1sX7Rb6Z9E1_JdG-Uf4HdcjxawgC3RLoRt1m7Akn40DQ/edit?hl=zh-TW#gid=0')
wk_list=sht.worksheets()
wks=sht[0]
cell_list=wks.range('A3:A4')
wks.update_values(cell_list,values=[[0,2]])
and it goes
InvalidArgumentValue: crange
then I tried
wks.update_values(cell_list=cell_list,values=[[0,2]])
it shows
TypeError: list indices must be integers or slices, not list
after that I tried crange
wks.update_values(crange='A3:A4',values=[[0,2]])
the error message is
HttpError: <HttpError 400 when requesting https://sheets.googleapis.com/v4/spreadsheets/1sX7Rb6Z9E1_JdG-Uf4HdcjxawgC3RLoRt1m7Akn40DQ/values/%E5%B7%A5%E4%BD%9C%E8%A1%A81%21A1%3AA2?valueInputOption=USER_ENTERED&alt=json returned "Requested writing within range ['工作表1'!A1:A2], but tried writing to column [B]". Details: "Requested writing within range ['工作表1'!A1:A2], but tried writing to column [B]">
wks.update_values('A3:A4',values=[[0,2]])
get me the same thing
I found the docs, it said the 'cell_list: List of a :class:Cell
objects to update with their values.', then why can't I execute the codes above?