How to Access Old and New Versions in Google Sheets Trigger (Row Updated)

Hi everyone,

I’m using the Google Sheets Trigger node in my workflow with Trigger On set to “Row Updated” and Include in Output set to “Both Versions”.

In my workflow, I need to access both the old and the new versions of the updated row.
How can I reference these two versions inside the workflow?
Is there a specific format or structure for accessing them?

Any help or example would be greatly appreciated.

Thanks a lot!


To access both the old and new versions of the updated row in n8n when using the Google Sheets Trigger (Row Updated), you can follow these steps:

Solutions:

  1. Use the Data from the Trigger Output:
    When you select “Both Versions” in the Include in Output option, n8n will automatically include both the old and new row data in the output. You can reference them in the workflow like this:
  • Old version: {{$json["old"]}}
  • New version: {{$json["new"]}}
  1. Check the Data Structure in the Trigger Node Output:
    You might want to check how the old and new versions are structured in your workflow output. You can use the Set node or Function node to extract specific fields. Here’s an example of how to reference the new and old rows:
const oldRow = $json["old"];
const newRow = $json["new"];
return { oldRow, newRow };

Hi,

Thanks for your response — I tried following your instructions, but I still couldn’t get it to work.

Could you please provide me with a complete example?
This would really help me move forward with my workflow.

Thank you! :glowing_star:

Let me add-on more here

In the Google Sheet Trigger. You need to select Both Versions

Then you will get this kind of data. Which includes Old and New version at the same time.

[
  {
    "previous": {
      "row_number": 155,
      "change_type": "updated",
      "date": 45826,
      "integraions": 2222
    },
    "current": {
      "row_number": 155,
      "change_type": "updated",
      "date": 45826,
      "integraions": 3333
    },
    "differences": {
      "row_number": 155,
      "integraions": {
        "previous": 2222,
        "current": 3333
      }
    }
  }
]

Thank you for sharing the details.

I made sure to select Both Versions in my Google Sheets Trigger — just like in your screenshot — but the output I’m getting is different from what you described in your previous response.

If you look closely, my output shows the entire list of items in the sheet instead of just the old and new values for the updated row.

Could you please provide me with more guidance or a clear example?

Thank you in advance for your help! :glowing_star: