I have a google sheet in which I would like to add data to a certain range:
And to write the data I use:
ws = sheet.worksheet('test_sheet')
ws.update("HG3:HG5", [["test_1", "test_2", "test_3"]])
But I can an error:
APIError: {'code': 400, 'message': 'Requested writing within range [test_sheet!HG3:HG5], but tried writing to column [HH]', 'status': 'INVALID_ARGUMENT'}
Why does it try to write to column HH
if the range is clearly HG3:HG5
? I do have a range that contains 3
cells and values inside ws.update
also has 3
values. I tried using single brackets for ["test_1", "test_2", "test_3"]
but that produces another error.
Where is my mistake? My goal is to be able to write values to a single column's range as in the image the values would become "test_1", "test_2", "test_3"
.
CodePudding user response:
The notation
[["test_1", "test_2", "test_3"]]
writes into 3 columns of the same rowTo write into 3 rows of the same column, the notaiton should be
[["test_1"], ["test_2"], ["test_3"]]