How to get Google sheet get rows node response if rows not found?

Hello everyone! I recently started to explore all the possibilities of n8n and like many newbies I encountered a problem, although perhaps I should spend more time.

I am creating a pipeline where I make a request to the API and get a list of dialogs, each dialog has its own unique ID. I want to write a new record to my Google spreadsheet (I use it as a database) if there is no such record yet.

My table has a Conversation ID field and I am trying to do Get Rows with the Conversation ID={ID} filter

And if such a record already exists, then go to the next action, and if it does not, then add a new record. But the problem is that the Node that does Get Rows returns data only if the rows are found, but does not return anything if there are no rows (and this is exactly what I need to make sure that such a row is still not in my table).

Or should I use some other way?

  • n8n latest version:

Hi @Viktar_Kamiahin Welcome to n8n :n8n: community :tada:

There’s an option in the Settings tab called Always Output Data


In your case, when no rows are found (i.e., no output), enabling this option will return an empty item instead of returning nothing.


However, for your use case, you can also try using the Google Sheets node with the Append or Update option.


This will allow you to add a new row if the Conversation ID does not exist yet or update the existing one if it does.

It’s a simpler way to handle this logic without needing to manually check for existing rows first.

Hey! Thanks for the answer.

The main problem with using Append or Update is that if I want, for example, to insert values ​​that did not exist yet (for example, Conversation ID and Status=PENDING) in order to subsequently process all records that have the PENDING status, then the Append or Update function will update all records, even those that have already been processed.

For example, I ran the process once and a record was added to my table

Conversation ID = 2
Status = Pending

Then I processed this record in another node, and the status changed to DONE

But when I run the process again, my node will apply Append or Update to this row and change the status from Done to Pending.

The main idea is to add only new records to the table and ignore those that have already been added if they still came from the API

I may have found a solution, it’s quite crooked, but it works.

I insert new IDs using Append or Update but don’t write any status, and then using Get Rows I select all records with empty status.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.