Copy data from one cell to various columns with values

Hi,

The have the below data in one cell in excel

Employee number: 12345
Employee name: Name
Phone Number: 1234567890
Job Role: Trainee
Start date: 15-10-2018

I want the data to be split to various columns with their values below them.

|Employee number |Employee name | Phone Number |Job Role |Start date|
|12345 | Name |1234567890 | Trainee | 15-10-2018|

Can anyone help me out?

Thanks in advance

Hi @Vani11,

You can read the data from excel and then split them into different variable, once you have the values you can build datatable and insert values in the table by AddDataRow

See this sample -

Main.xaml (12.9 KB)

Test.xlsx (8.9 KB)

result.xlsx (8.4 KB)

You can modify this sample according to need

Thanks,
Prankur

1 Like

Thank you so much for your reply.

The xaml file says ‘Could not find member ‘CurrentIndex’ in type ‘http://schemas.uipath.com/workflow/activities:ForEachRow’. Row: 102, Column: 20’ .

Please advise

Are you using the latest version? Reinstall package might fix this

Yes. I’m using the latest version. Can you tell me which package to reinstall?

Any activity which you are not able to see? Or are getting this error when you run the program

Can you attach a screenshot

image

UiPath.Core.Activities is the package. Also is that does not work do this

image

Thank you @PrankurJoshi. When I tried to update the UiPath.Core.Activities package I get the below error

Restart the studio and try again

No Luck :frowning: Anyways I will try the solution you have provided and will get back to you.
Thanks once again

Thank you so much @PrankurJoshi. Your solution for splitting the cell data to various columns worked. :slight_smile:

1 Like

@Vani11

Read the Cell and and save in a string let us take as strValue

Array Values=  (From p In (strValue.Split({Environment.NewLine},StringSplitOptions.None)
                        Select Convert.ToString((p.Split({":"},StringSplitOptions.None)(1))).ToArray

Now Use Add DataRow Activity and pass the variable Array Values.

Regards,
Mahesh

1 Like

Hi @MAHESH1 Let me try your solution as well and get back to you :slight_smile:

Thank you for your response

@Vani11

You can do by using simple Regex

Use Matches Activity and pass this pattern (?<=:).* input string should be the value you extracted from cell.

After that convert the collection to the array of strings and pass it to AddDataRow Activity.

Regards,
Mahesh

1 Like

Sure.

Regards,
Mahesh

Thank you @MAHESH1. Your solution worked as well.

Thank you @PrankurJoshi and @MAHESH1 for your response :slight_smile:

2 Likes