Sending E-mail According to a Value in Excel File (in a For each row Loop )

Hello, I am running sql query and come up with a data table. I am writing this data table into an excel sheet. The question is, according to a value that is in Excel sheet, firstly I want to filter the datatable, then write it to a new excel and send e mail (with filtered excel attachment) to people by using SMTP. This process is also expected to be recurrent (using For Each Row). How can I do that, could you please share your suggestions ? Thanks in advance,

Hi @mertkahveci :wave:

Follow the below given steps:

  1. Use an Execute Query activity to get data from DB using select. This will return a Data Table.
  2. Use a Filter Data Table activity to filter the DT based on certain value.
  3. Iterate through the filtered DT
  4. Use SMTP to send email

Hope this helps :slight_smile:


Hi @monsieurrahul Thank you for the response, however my question was more specific. I believe I’ve already done the things you said and my question is about while making this workflow recurrent, (according to value in excel), I also dont want my “for each row” loop to iterate through values that it had already iterated before. Is there any “” or " drag-drop activity" solution for that ? By the way the picture of the workflow is attached. Thanks a lot… (I’ve already solved executing query,creating data table part, the question is about the loop in excel automation.)

For instance, lets assume that “for each row” iterated through the table and passed the string value (“300”) and if the following value is again (“300”), I don’t want it to iterate and send e mail


In that case you need to add an additional column to your Excel like status and update that after the email is sent so the next time, you can ignore the rows with status as ‘complete’ or ‘mail sent’ and only send mails to those with status as empty.