Add Column in Google Sheets module instead of Add Row

So here’s one approach to get the next available column.

Google Sheets Make an API Call configured like this:
image

Replace <spreadsheet_id> with your actual spreadsheet ID and Sheet1 with the name of the sheet you’re using.
That will get you all of Row 1.

The API won’t return empty rows and it will return an array of values from that row.
For my example, that’s:
image

Length of array is 3 meaning 3 is the last used column, so start writing on column 4.

Still need to make assumptions, such as you will always have data in the first row of every column, otherwise you run the risk of overwriting a column. To prevent this, if you can, try to use a placeholder in a cell to indicate it should be blank, like a 0.

Also, when writing to cell, need to use R1C1 notation rather than A1.
If you want to use A1 notation, you’ll have to figure out which letter corresponds to the column number.

Hope that helps!

4 Likes