Unable to match outlook body word with Excel list keywords c#

Hi Team,
I have list of keyword in excel sheet.
i want match and find the same keyword in outlook email body.
when i assign a variable to the excel list to store, and find if it contains in email body; but there is 0 result with condition for the activity(if). am i missed something here? if i hardcode the condition<email.Body.ToString().Contains(“keyword”)>, it is work fine.

Hi @balaraj.pubalan

Check that the variable exists correct data or not with a message box or log message

Yes. i able to list it with log message and the outcome is good.

Hi @balaraj.pubalan ,
I think you need use 2 loop to compare all elements in excel with all mail body
I have created a process same
you can check


1 Like

Hi @balaraj.pubalan

Could you try the below condition in If.

email.body.tolower.toString.Contains(strExcel .toLower.toString)

Hope it helps!!

1 Like

not working. no result or output for the condition.

May I know what is the variable name of Output datatable.
After there is an assign activity what you have initialized the value for strExcel. @balaraj.pubalan

Hi @Nguyen_Van_Luong1 Is there you make the email body written out to excel first to match with another checkIN excel?if i understand this correctly?

it is odtExcel
odtExcel.ToLower() Assign to strExcel.

Hi @balaraj.pubalan
yes, I think this will correct.
I tried with for each mail.body.contain string in excel,
but it have result not correct, you can try my solution

1 Like

In that case I have given the condition which is correct one.
Once try the below one.


same…i cant get the output with this condition.


If i hard code it, it is working…

Hi @Nguyen_Van_Luong1 Actually this is comparassion in excel but i want to do acticity in outlook if the word match, i want to do some activty on that email.

it’s just a matter of comparing email and excel
it’s a simple matter of UiPath
you can try my way
Or can you share your sample file and sample email

keyword.xlsx (15.6 KB)
emailbody.xaml (14.6 KB)

Attached is list in excel to detect and activity in outlook…

Hi ,
You need compare keyword with body mail.
That’s right?
after that, What do you need?
Paste Status in keyword?

keyword.xlsx (55.3 KB)
compare_mail_excel.xaml (21.8 KB)
You can try

1 Like

not paste the status again instead i want that email get deleted.

yes. use delete outlook message
compare_mail_excel.xaml (17.8 KB)
Try this solution

sorry…i cannot open this file in my studio.may i have the screen shots with variable? else i need to go trough the code in xml file on by one…Thanks :slight_smile: