My google sheets "check if new data" is triggering even if no new data

Hi all,

I have attached a workflow (I didn’t add the email at the end as I didn’t want to spend time removing personal info for this public post).

I have say, 10 rows in the spreadsheet and every 6 hours, the system is sending me 10 emails. The data is not changing (that I can see) in the google sheets, yet this keeps happening.

Eventually the sheet DID change and it went to say, 11 rows. I thought that might trigger some kind of ‘change / cache’ thing and it would work, but, no. It now sends me 11 emails every 6 hours.

Can anyone see what I might be doing wrong?

Thanks so much. I very much appreciate any help on this.

Please share the workflow

n8n Version

0.183.0

Hi @privateuserguy, I am sorry to hear you’re having trouble.

I tried reproducing your problem using a Google Sheet like this:

image

When first executing my workflow, these two rows are returned by your Function node as expected:

When executing it again, no rows are returned:

Now I update my sheet like so:

On the next run, only the new row is returned by the Function node:

I’ve updated the Function code to log the data at the beginning and end of each execution (by adding two console.log statements) and the update seems to work as expected (after the third execution, ID 3 has been added to the static workflow data):

image

So this seems to work as expected for me. There are two problems I can think of here:

  1. Are you by any chance manually executing your workflow? Static data would only be available in production executions.
  2. Are you updating your workflow between executions? Static data is part of your workflow JSON, so overwriting your workflow might cause trouble here.

As a workaround you might want to consider keeping track of your processed IDs outside of the static workflow data, for example in another Google Sheet (that simply tracks all processed IDs from the original sheet - you could then compare the IDs from each of the two sheets using the Merge node’s Remove Key Matches mode). This approach would mean that manual executions for example wouldn’t cause any problem here.

Hi there and THANK you for such a detailed response.
I noted you have an ID at the start (first column). Is that required to be in the format you have?

Mine is as such:

I would imagine that the timestamp would be enough to be different, but if not, and it’s looking for an incremental integer it could be that?

If not, I’ll gather some more info based on what you’ve got in your reply. Thanks again

Further, if I execute the node manually, no matter how many times I run it, I get this:

I noted you have an ID at the start (first column). Is that required to be in the format you have?

No, I based my columns on your code which suggests you have three columns ID, Name, Email and in which you were using the ID column to keep track of processed data:

        id: items[i].json.ID,
        name: items[i].json.Name,
        email: items[i].json.Email

Any unique value could do the job.

Further, if I execute the node manually, no matter how many times I run it, I get this:

Yes, that’s what I mentioned above:

  1. Are you by any chance manually executing your workflow? Static data would only be available in production executions.

Your approach won’t work if you manually run your workflow which is why I wouldn’t suggest it unless absolutely necessary.

If you have a unique identifier for each of your rows you might want to consider the suggested workaround of keeping track of your processed data in a separate Google Sheet rather than using the static workflow data.