Loop through CSV file before sending Email

Hi All,

I have a requirement where I receive a CSV file containing Owner Email, Id and other details as column.
I want to send an email to the people in the “Owner Email” column of the CSV. But it is possible that one Email can have multiple entry.

In that case I want to loop through the data and send the data related to that email address together in one email. So I don’t want to send seperate email to the same email address , rather I want to loop through the csv to see the email address related data and send everything in one email.

So if an email has multiple entry in the table , I would like to send everything related to this unique email in one email.

Can you please help me with suggestions on how to achieve it?

@asingh760

You can group the records from CSV file based on the “Owner Email” field, using Group By Fields Snap. So that, for each email address you will have all the related data in separate group.

After that, in a Mapper Snap you can use Array Functions in order to loop through each of the group and get appropriate data for each email. After you get the needed data, in Email Sender Snap, in “Template Body” field, you can pass the data entry for each email address.

Regards,
Spiro Taleski

2 Likes

Thank you for the response on this.
I am able to group by data and used mapper to read one by one. The output of the mapper looks like this
image

I don’t know how to use this in email send snap

I used this but it is not sending data to each user with the details

@asingh760

I am attaching two sample pipelines:

1)Parent - which groups the data based on the email and send the data to Child pipeline.
2)Child - which split the groups, apply xslt transformation(generate HTML table), and send the table through email.
Parent_2021_08_27.slp (4.9 KB)
Child_2021_08_27.slp (10.2 KB)
Also, I am attaching the sample XSLT file, which you can modify based on your requirements:
XSLT_Transformation (1).txt (1.1 KB)
Note: You must create a SMTP account in order to be able to send emails, using Emails Sender Snap.

Regards,
Spirp Taleski

2 Likes

thanks a lot Spirp to provide detailed example with solution on this.
I have one last question. I want to send the grouped data in the email to the people.

I am not able to use the parameter’s using format " +$owneremail+" in the html body of the email.
If I use email type as html table it fails.
Do you have any idea on how to do that?