Tutorials & Examples Web-help Blog

Send email from CSV values


#1

Hi folks!

I’ve tried to solve my problem for hours, now I think I could need some help.
I’m trying to send an email to several users. Sending emails with a name parameter for instance is working (I’ve tried the example email_sendout before). But I’m having problem with sending each user only data based on rows from a CSV.

Project 1:

  • Import delimited CSV and run some calculations
  • Export into XLS
  • Send email to a user with XLS attachment

Project 2:

  • Import user list from delimited CSV
  • Project 1 iteration

Purpose: If there is certain data missing in the output XLS in project 1, each user from project 2 should get only this certain dataset.

Problem:
After running P2, each user from the list gets the same XLS containing all data (also the one for other users).

E.g.
| Reference | user |
| 100 | 1 |
| 200 | 1 |
| 300 | 2 |
| 400 | 2 |

User 1 gets an XLS containing 100 & 200, user 2 gets 300 & 400.
How can I achieve a filtering of the data and, if applicable, generate a new dataset per user?
Alternatively, no XLS has to be generated or attached. One email per row can be sent, containing all info inside the email body.

Thanks in advance,
Michael


#2

Hi Michael,

as I understand you need two-step filtering here:

  1. Filter the reference table
  2. Filter the exported dataset according to the filtered reference table

To achieve this, you can load the reference table in Project 1 and filter it to keep only the rows that only the user specified by the parameter can see. For filtering can use the “Filter by condition” action with condition [user] = {User ID}.

For instance, if the filtering is done for when parameter {User ID} = 2 your reference table should look like this:

| Reference | user |
| 300       |    2 |
| 400       |    2 |

Now, before exporting into XLS use the “Keep matching” action to keep in the XLS file only rows that correspond to the Reference column.

You can pass from Project 2 the user ID (used in the reference table) together with the user’s email as parameters to Project 1. In this case Project 1 will have two parameters - user’s email (used for the “Send email” action) and user ID (used for filtering the reference table).

Alternatively, use the user email instead of user ID in the reference table. In this case it would look like

| Reference |  user    |
| 100       | aa@x.com |
| 200       | aa@x.com |
| 300       | bb@x.com |
| 400       | bb@x.com |

In this case the user’s email can be used for filtering the reference table and for sending an email.

Let me know if you need an example.