Looking for an elegant way to update a Google Sheet

Hi,

I have a number of columns in my Google Sheet where the heading is ‘Day 1’, ‘Day 2’, ‘Day 3’, etc. When my workflow is called, I receive a value for example ‘1’ which means that I need to update the column where the heading is called ‘Day 1’.

Is there an elegant way to do this other than putting if statements in every one of the columns of the update row node? I was considering something like this:

{{ Number($json.headerNumber) === 2 ? $cellValue : null }}

Not elegant and it has the side effect of nulling existing values in the other cells. I want the cell to remain intact and not be overwritten.

{{ Number($json.headerNumber) === 2 ? $cellValue : $json.cellvalue[‘Day 2”]}}

This works but it’s qite unmanageable with a large number of columns. I have 30 so it’s not that bad but if there is a more elegant way.…

Thanks,

L

Hey @DupervalAI

just to make sure I understand the question correctly.

You have a sheet with the header row (presumably row #1) of
Day1, Day2, Day3 etc, (one per column)

and when you receive the data in the workflow, you want to update the cell value on the row #2 for the column corresponding to the day number from the received data?

As in not added as a new row, but all updates happen for the same row, just different cells?

If my understanding is correct, take a loot at the following example:

Here is my sheet:

and here is the configuration of the sheet node:

Ah, you’re using the Automatic mode to update. I was usig manual. Let me see if I can make that work.

L

It woiked! Thank you!

L