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:

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)));"")



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(", ",".") + ""


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:


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)