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.
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):
So this seems to work as expected for me. There are two problems I can think of here:
Are you by any chance manually executing your workflow? Static data would only be available in production executions.
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?
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:
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:
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.
I sort of threw my hands up in the air over this some time ago, but, need to put on my big boy pants, roll up my sleeves and get into it.
Your suggestion I assume would be something like this:
1 Create separate Google Sheet.
2 Add Timestamp (as unique identifier) of each item into new Google Sheet
3 Somehow check if the Timestamp exists (some comparison), then if not in new Google Sheet, continue and send email, then add new Timestamp to new Google Sheet
Does that seem right?
Thanks agian for your suggestions and time on this.