If row contains specifik value, then send that row, to an email

Hallo.

I have a lot of rows in a excel sheet.
If a specifik value/word is in that row, then i wanna send an email, with that current row.

Please help :slight_smile:

Hi @christian.bendtsen ,

To be more accurate, Could you show us a format of the email that you would be sending if the condition matches with an Example Excel sheet data if you would ? Do also provide a screenshot of the example Excel sheet data.

Hi @christian.bendtsen,
You can start with below steps:
1- Read Excel File first using Read Range Activity and add output in DataTable.
2- Make For Each Data Table and iterate on all Rows in the datatable.
3- Add IF condition with your Needed validation like for example Currentrow(“Column Name”).equals(“the validation value you need”).
4- In case of True use Send Outlook Mail activity with all needed Values like (To, CC, Subject and Body).

Hope this help you and in case you face issue in any of the above please share with us to support you better :slight_smile:

The format of the email. would just be something like this:
"hallo here is status

the specifik row that contains a specifik name

kind regards"

I’ll attache the excel.

So if a row contains fx “københavn”, then i want to send the whole row, to an email adress.
test11.xlsx (10.4 KB)

The format of the email. would just be something like this:
"hallo here is status

insert the whole specifik row that contains a specifik name

kind regards"

I’ll attache the excel.

So if a row contains fx “københavn”, then i want to send the whole row, to an email adress.
test11.xlsx (10.4 KB)

Hallo Mahmoud :slight_smile:
I have done that already, but i want to send the whole row that contains that specific name, to an email address.
Does it make sense?

@christian.bendtsen ,

Assuming you are already handling the logic of contains of particular word that you want to filter the row.

Then after the row contains the particular word is a match, you could convert the row to Datatable using the below Expression :

{row}.CopyToDatatable

Above expression will convert only that particular row to Datatable, which will also include the headers of the Datatable.

After performing the above operation, Check the below post on converting the datatable to HTML table, so that you could add it in email body.

Let us know if you are not able to understand the steps or if the requirement is not as mentioned.

Hallo :slight_smile:
I have not handle the logic about containing a specifik word, can you please explain how to?

If i understand right you need to get all data from the row and compare it with specific word in this case you need to merge all data and you can find below solution for that then you can use that output in if with contains condition.

1 Like

@christian.bendtsen ,

Could you let us know whether you are trying to Check the particular word in a particular column in the datatable or it can be in any column and if found in any of the columns in the row, you would want to append that row data to mail ?

yes…
so when you look at the excel sheet i send you.
i want to go through all rows in the first Colum. and if a row contains “københavn” or “hvidovre” fx, then i want to safe that specifik row, with all the data, and send it to an email address :slight_smile:
Make sense?

@christian.bendtsen ,

Could you Check the below Image on the Outline of the Steps that needs to be done for achieving the result :
image

The Condition placed in If Activity is the below :

row.ItemArray.Any(Function(x)x.ToString.Contains("københavn") or x.ToString.Contains("hvidovre"))

The Assign Activity that converts the datatable/row to HTML Table is below :

HTML_Table = "<table border=2><b><tr><td>"+String.Join("</td><td>",{row}.CopyToDatatable.Columns.Cast(Of System.Data.DataColumn).Select(Function (x) x.ColumnName).ToArray)+"</td></tr></b>"+
"<tr>"+String.Join("</tr><tr>",(From x In {row}.CopyToDatatable.AsEnumerable
Let cells="<td>"+String.Join("</td><td>",x.ItemArray)+"</td>"
Select cells).ToArray)+"</tr>"

Let us know if you are still unable to perform the steps and provide us as to which step are you facing the difficulties.

Could you please send me the xaml file?

@christian.bendtsen ,

Check the below workflow, However it is just an outline of the Steps. You would need to adhere the steps to your data.
PrepareEachRow_AsMailBody.xaml (8.4 KB)