How to one column's values into two separate columns in UiPath?

Hello,

I have looked through the forum at similar topics, but I was not able to find one that answered my question sufficiently. I have an Excel sheet which contains data in one column (some numbers and text all in single cells). I would like to take this single column and split it into two separate columns by separating the numbers and text.

Here is an example of what the before Excel would look like:

1

And here is what I want it to look like after:

2

I’d really appreciate your help if you could provide me with an approach or some example of this being completed.

Thanks!

Hi @H.E.Pennypacker,

  1. Use a For each loop to iterate thru the data
  2. Inside the loop you can use string functions to split the row value. Looks like your values are split by space:
    arrResult = str.Split({" "c}, StringSplitOptions.RemoveEmptyEntries)
  3. For this example you will have 2 values in the array, use it like:
    row(“A”) = arrResult (0)
    row(“B”) = arrResult (1)

Hope this helps you!

Regards,
PD

Hey PD,

Thanks for your response! The data I submitted a picture of is actually a system generated listing, and it actually has two spaces BEFORE the numbers. I have a feeling this would conflict with using " " as the value to split by.

Do you think this would cause a problem?

Another thing I think would help is that there are always the same number of characters from the beginning of the cell to where the Text appears (the text part has different values with different character lengths). Do you think there’s a way I can tell UiPath to split the file up to the first 10 characters only, for example?

Hi @H.E.Pennypacker,

Use the Substring method to get the first 10 characters like:
result = str.Substring(0,10)
If you would like to remove the spaces then use Trim method.
str = str.Trim

Here are some good links on String methods:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/
https://www.completecsharptutorial.com/csharp-articles/csharp-string-function.php

Happy Automating!

Regards,
PD

Please provide .xaml file