I’m trying to build a workflow where I have a variable called Count that should increase by 1 only if a specific Google Sheets cell has a value inside.
What I would like to achieve:
Keep the existing value of Count from previous nodes.
Check a cell in Google Sheets.
If the cell is not empty → increment Count by 1.
If the cell is empty → keep Count as it is.
I’ve tried with the If node, Set node with expressions, and even a Function node, but I’m having trouble combining the data from Google Sheets with my existing Count value. I’m not sure if I should use a Merge node or handle everything with an expression. To be honest i am trying to understand but i feel a bit lost now, and its the last step for my workflow to be “active“ in my real-life environement.
Could someone please show me a simple example of how to set this up in the n8n interface?
That’s interesting — it works to update the value, but what I would like to do is loop through part of my workflow if there is something written in the cell.
Thats for the quick reply by the way
Let me explain a bit more:
I need to upload some info into my company’s Google Sheets.
I have a Google Drive folder set up that uploads a photo/PDF to n8n.
This photo goes through OCR with ChatGPT.
I then clean the data and add a count value (default is 13, because I need to update the 13th row in Google Sheets).
Right now, without using count, my workflow works — but it always updates the 13th row.
What I’m trying to do is find a way to increment the value I send to the Google Sheets Update Row node if a cell is not empty.
It also seems like I need to loop through that part of the workflow, because if there’s already data in row 13, then the logic that:
updates the value of count,
checks the cell in row count + 1,
verifies if it’s empty,
outputs true or false,
…needs to run multiple times if there’s already a lot of data in the sheet.
So essentially, the nodes also need to use the updated count variable, and each time it changes, re-use that new value with count + 1 added.
Ok guys I already have a solution.
I extracted a part of my Sheet (only the part that i need to write some data) with get rows node.
After i have a if statement that checks if my cell is empty or not. And if not empty it passes to the next cell to check automaticly…
It seems that it looks for an empty row in the collumn and then when he findes it it outputs the row number and i can use this for the rest of the workflow…