Split Emails By slash and type into Outlook Mail Message Activity

I have a cell in my excel which looks something like this


Now How Do I Type these emails into my To section of my send outlook mail message activity.

Hi @Ishan_Shelke1 ,

Assuming you would need both of the Emails in the To Section, we can do so by Splitting them by Slash (/) and Joining them using colon (;) like below :

1 Like

Hey @Ishan_Shelke1,

You can use the replace method to replace the “/” with “;”.

Sanjit Pal

1 Like

Actually I have multiple cells like these and some of those contain a single email also while some have two emails in it seperated with a slash like this


Email ID’s are different in my case this is just an example, So now How do I do It ?

Additionally If Duplicate Email Id’s appear I want to type them only once.

@Ishan_Shelke1 ,

Are you reading the Excel as a Datatable using Read Range Activities ?

After reading it as a Datatable, we should be able to use For Each Row Activity and loop through each of the rows.

By Looping, we can access each column value required, in the below way :


Now we can make the Changes with the Email value as mentioned in previous post :

ToEmail = String.Join(";",Split(CurrentRow("EmailColumnName").ToString,"/").Select(Function(x)x.ToString.Trim).Distinct.ToArray)

Here, ToEmail is a String variable which will contain he Email values to be used in the Outlook Mail Activity

The Expression should work for both the case

Hi @Ishan_Shelke1,

You can use Split(EmailStr,"/").Count to get the number of emails.
If it’s one, take EmailStr as it is.
Else use String.Join(";",Split(EmailStr,"/").Select(Function(x)x.ToString.Trim).ToArray)

Hope this helps.

Warm Regards,
Ashwini Kempraj


So this above statement will come in the To of the mail activity

Where do I pass this ToEmail String variable ?

@Ishan_Shelke1 ,

You should pass that variable in the To Property of the Mail Activity.

Ok This is working when I have My Email Column name, What If I don’t have a column name for that email column

@Ishan_Shelke1 , Is the Email Column always at the Same Position ? Then we can go with the index of that Column, If it is the First Column, then use the index 0, Second Column then use index 1 and so on…

Expression could be modified like below :

ToEmail = String.Join(";",Split(CurrentRow(0).ToString,"/").Select(Function(x)x.ToString.Trim).Distinct.ToArray)
1 Like

In this as you can I have multiple same email Id’s so how can I ignore those duplicates and only type them Once ?

@Ishan_Shelke1 , The Above Query has .Distinct which only keeps Distinct values, meaning the Duplicates are removed.

Do you still face Duplicacy issues ?

Yes I am still Facing Duplicacy issues

@Ishan_Shelke1 , Could you show us the Input Data and What is the Output value Generated using the Expression provided above ? You can use Write Line Activity to print the values so we can understand the differences before and after the use of the Expression.

Ok You were right basically it’s checking for every row

If if a row contains duplicate values it will only display them once

But that’s not what I intent to do.


Like in this image 2 email are appearing multiple times so I want to only send email Once No matter how many times they appear ahead

I’ll Provide a more clear picture :

Suppose this my data


So ishanshelke7777@gmail.com should get a email output as - 1,2,3,4,5
and ishan.k@quantasis.com should get a email output as - 1,3,5

Hope this makes the picture clear

@Ishan_Shelke1 ,

My Apologies, Though I get the Idea, the Output as to How you would require it is unclear.

In terms of your first question in the Post :

You would want to type in the Distinct Emails present in the Excel, but we do not know How exactly the Mails need to be Send to the Recipients.

Suppose, We have 3 rows in Excel with 3 same emails, do we need to group these and Send it as a Single Mail ? Also not sure How it would affect the Other Data.

Maybe Explaining what is you current Process/What you have done currently would help figure out the Output Format required.

The Requirement Is Taken Back From My Client Thanks For Helping :grin:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.