Validate email based on sender name in Excel file and preform action

Hello All, i have a task that is:

-check the email inbox ( Your Mailbox)
-if the email has the following criteria:
sender exist on the excel sheet &
email subject is “Test Bot”
1-the bot will open the browser and navigate to the corresponding url based on the sender
-else - if the sender does not exist in the excel sheet, he will receive and email that “you are not authorized to perform this task”
2- create a txt file, name it with the sender name + the current date and time,
3 write inside the file “ Successfully navigated to (the URL that belongs to the user)”
4 store the text file in a predefined folder
5- send a success email with txt attached

So,my program works but i have a logical error from the for each row activity, since iam looping for each name, if i find the sender then proceed correctly, but the robot will then go over the names and reply to my sender that he is not authorized, how can i stop this from happening ?

Excel file looks like
Sender URL
John www
Alex www
Sam www

So if sender is john and subject is correct i retrieve the URL and send john the attachment, but the i send john 2 emails because the next two rows dont match.
Any help ?

Hi @ribal welcome to forum

I think you can do this in more simplified way

Check this workflow
email.zip (39.8 KB)

Hope it helps you

Regards
Nived N
Happy Automation

hi @NIVED_NAMBIAR ,in the look up data table, dont i need to specify the target column to get the URL? also what if the Sender is in excel but the subject doesn’t match ? I didnt use a lookup table because i didnt understand how to add a condition after finding the sender to it (like you did is row<>-1). <- what does that also mean ?

No need of adding the target column here as we are retriving using dt1.Rows(row)(“URL”).ToString in open browser section.

Lookup Datatable activity will look for the value in datatable under the given column and output the rowindex of the row in the datatable which contains the lookup value.

if the sender details are not there the rowindex will be -1.

row is the varaible which stores the rowindex of the lookup datatable activitiy.

row<>-1 implies that rowindex is not equal to -1.

if row<>-1 then the sender data is existing in the excel and do the corresponding action in then section (like create a text file with file name as sendername, writing the data in the text file, sending the mail as attachment )

In else section, which occurs when sender data is not existing then in else section a mail is send which says u are authorized to url.

Hope the description helps you

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

2 Likes