Selecting data from Excel and sending an email in UiPath

I have an Excel sheet with multiple columns, e.g. names, values, etc…The table is in the following format:
Capture9

I want to compare values from both columns ‘Value1’ and ‘Value2’, so if Value1-Value2 > 0 then send email to corresponding user with the selected data as an attachment, in this case to the user ‘Lastname4, Firstname4’ (one row only).

Also, can we create the email address on the fly based on the column ‘Name’ in UiPath? In Excel the formula to do so for the 1st row would be something like this: =CONCATENATE(TRIM(MID(A2&“.”&A2;FIND(“,”;A2)+1;LEN(A2)));“@domain.com”)

Thanks

1 Like

Hi @Jasu

No problem at all.

Here is a sample process flow:

  1. Read Range activity to read the data into a Data Table variable
  2. For Each Row activity to loop through all the rows of data
    (This allows you to work on 1 specific row at a time)
  3. Use an If activity with this condition to decide on whether to send an email or not. You can access an element in a row with this syntax: row.Item("Value1").ToString. Depending on the situation, you might need to explicitly convert those values to an Double or Integer value
  4. To generate an email from the first column, you can use similar logic to your Excel formula. Method called .Replace can be used to replace , and a space with a dot, and a simple concatenation afterwards can add a domain:
    yourstring.Replace(", ",".") + "@domain.com"
2 Likes

Thanks ‘loginerror’, very handy information. I will give it a try.
How to switch the ‘lastname.firstname’ positions? The email should be in this format: firstname.lastname@domain.com

You can use the .Split method on your string to split it by a comma into an array of strings (feel free to look up on the forum here, there are plenty of examples).
After the string is split, you could then concatenate your string accordingly :slight_smile:
Something like that:
youNewArray(1) + yourNewArray(0)

1 Like

In the above example how do we send one email to all users whose Value2 < 3000?
Any idea would greatly help.