Separating string in an excel column

Hi All,

I have a column with "EmployeeName in an excel file the data will be like:
Naveen Kumar S. I want Naveen Kumar as first name and S as last name.
I mean I want split a name which is in a column to two separate columns.


Input File


Expected Output

Please someone help me to achieve this.
Thanks

1 Like

Hi

Hope these steps would help you resolve this

—use a excel application scope and pass the file path as input and get the output as dt with read range activity

—now use a BUILD DATATABLE ACTIVITY with two columns we want and get the output as dt_final

—use a CLEAR datatable activity and pass the above dt_final as input

—then use a FOR EACH ROW activity and pass dt as input

—inside the loop use a assign activity like this

Intcount = Split(row(0).ToString,” “).Count

Where intcount is a variable of type int32

— then inside the for each row loop use ADD DATAROW activity and mention the property as

Arrayrow = {
String.Join(“”, Split(row(0).ToString,” “).Take(intcount - 1).ToArray()),Split(row(0).ToString,” “).Last.ToString}

And mention dt_final in datatable

Cheers @HeartCatcher

2 Likes

@Palaniyappan,

It worked perfectly thank you so for your help.

1 Like

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