Skip to content
Advertisement

Append value of variable to specific colum in google sheets

I’d like to write the value of a variable to the 2nd column in a spreadsheet. The below code works for the first iteration. Subsequent iterations are added as new rows in the first column:

JavaScript

update regarding pattern 1. Values are correct, but off by one row:

enter image description here

Advertisement

Answer

In your situation, how about the following patterns?

Pattern 1:

In this pattern, values_append is used.

JavaScript

Pattern 2:

In this pattern, update is used.

JavaScript
  • In this case, the last row of the column “B” is retrieved by len(worksheet.col_values(2)). If you want to retrieve the last row of other column, please modify len(worksheet.col_values(2)).

References:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement