I have this code, I need to append the values to the columns in my google sheet and the values should be added at the end of the sheet in a new row without deleting existing datas
all_values = worksheet.get_all_values()
row_count = len(all_values)
sheet_range = "'{}'!{row}:{row}".format(worksheet.title, row=row_count+1+insert_count)
values = {
"Name": "Ford",
"Age": "34",
"Color": 'Blue'
}
worksheet.append_row(sheet_range, values)
I figured it out, it's actually quite simple.
body=[0, 4, 9,7,5] #the values should be a list
worksheet.append_row(body, table_range="A1:E1")
#table_range should be range of columns in the sheet, example from A1 to E1 (A1:E1)
other parameters are optional.
this will append the values in body to the last row in the sheet and it will not overwrite existing data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With