Send an email once at start of Loop over items or Get Rows in Sheet

My workflow is like this

  1. Get Rows in Sheet

  2. Loop over items

  3. Do some stuff inside the loop

I want to send myself an email to inform me my workflow has started

If I add the email between 1 and 2 I will get the email multiple times.

If I add the email inside the loop the same will happen of course

I tried using an IF node and trying to find the index of the current item, but I got no idea how to do this exactly.

Can anyone help?

You are right that if you put the mail node inside of the loop you will receive an email for every row of the sheet. But you won’t receive multiple emails if you place the mail node right after the trigger as shown in the image below:

And I believe you wanted to receive an email for when the workflow starts so having this node right after the trigger seems logical.

Hi Mookie,

Yes, but I want to send information about the Google Sheet inside the Email, example: number of rows, Sheet ID, etc.

Then you can simply put the mail node after the sheets node. You see, only the nodes inside the loop execute multiple times. Any nodes after or before the loop work only once for every time the workflow executes. This image would explain it better:

Edit: I’m getting paranoid about my understanding of your problem. If it’s more complex than it seems please explain by addressing more details.

Hi Mookie, I have the exact sample you have there, but it sends an email for every row in spreadsheet. That’s not what I want. I just want it to send one email with the name of the spreadsheet etc. and then let it continue with processing each row in the Loop.

I also thought adding the email before the loop would only send one email.

This must work in that case:

I suppose the loop node executes every node in its own path for every batch. Having a different path connected to the same trigger must be the solution.

the thing is a node will run n number of times(n=number of json objects sent to node).
In your case these are all all number of rows in sheet.

what you can do is add code node before and after email node.

In before code node you can make one object and then format results in a way you want in email.
then send email
In after code node you can you can reconvert that data as required.

hope this will solve your issue.

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