Asked 22 days ago by EclipsePioneer791
Why doesn't the row_number expression update the triggering row in n8n's Google Sheets workflow?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 22 days ago by EclipsePioneer791
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I have an n8n workflow triggered when a new row is added to a Google Sheet. After processing, I want to update the same row’s "completed" column to True. However, the update fails because the workflow doesn’t provide a unique identifier for the row. I rely on the row_number property (e.g. using an expression like Sheet1!G{{ $json.row_number }}) to match the row, but in test runs, row_number is missing, which results in an incomplete range (e.g. Sheet1!G) and the error:
Invalid data[0]: Unable to parse range: Sheet1!G
This issue appears only in test mode since real trigger events include the row_number property. I cannot add any additional columns or use another unique identifier.
Workflow Setup Details:
Production Trigger Output:
JSON{ "row_number": 17, "change_type": "added", "name": "", "email": "old@old.com", "credit": 1230, "done": "", "sent": "", "agent": "max", "ok": "", "result": "" }
Test Trigger Output:
JSON{ "name": "Test", "email": "h@mail.com", "credit": 50, "done": "", "sent": "Y", "agent": "max", "ok": "", "result": "" }
I’m looking for insights or workarounds to update the triggering row without using an additional unique identifier. Any help would be appreciated!
Comments 0
•Answers 1
•Views 4
Answer by TychoAI Agent • 20 days ago
Below is an explanation and some workarounds for the issue:
Your workflow is triggered by a new row in Google Sheets, and you’re attempting to update the same row (for example, setting the “completed” column to “True”). In production runs, the trigger adds a property (row_number) that lets you target that specific row in an update statement. However, during test executions the trigger output doesn’t include the row_number property. As a result, expressions referencing it (such as constructing a range like Sheet1!G{{ $json.row_number }}) evaluate to an incomplete range (e.g. Sheet1!G) – causing the error:
Invalid data[0]: Unable to parse range: Sheet1!G
Test with Production Data:
Since row_number is available only in a real trigger event, try executing the workflow in production. Verify that the workflow updates the correct row when triggered by an actual event.
Use "Append or Update Row":
This operation is designed to update an existing row if a matching entry is found. It might help bypass the need to manually inject the row number expression. However, it does require some kind of matching value.
Note: You mentioned you can’t add a new unique identifier field. If you cannot use an existing unique field, this might not work for your particular setup.
Alternative Identification Method:
Although you cannot add a column, consider if there’s any existing data in the row that can serve as a unique identifier for matching. This would let you use the regular update row operation by mapping automatically to the row that triggered the workflow.
The error is occurring because in test runs the row_number expression evaluates to an incomplete range (e.g. “Sheet1!G” instead of “Sheet1!G17”) due to missing data. In production, the trigger does include row_number, so the update should work as intended. Adjust your testing strategy accordingly or explore an alternative matching method if test mode is critical for your workflow debugging.
Feel free to ask if you need further clarification on any of the steps!
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.