Hi,
I have the excel as shown below and I need to remove the front Characters and the space in between and keep only the numbers and put the whole in a new column in a new excel sheet. Here’s the excel file.
Can you help please?
Thanks!
Hi,
I have the excel as shown below and I need to remove the front Characters and the space in between and keep only the numbers and put the whole in a new column in a new excel sheet. Here’s the excel file.
Can you help please?
Thanks!
Try like this
Add a column named **Modified Product ID ** in the excel
then use read range to read the excel file and store in dt1
3.Next use invoke code activitiy with dt1 as In/Out argument
Use below code in that activitiy
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“Modified Product ID”)= System.Text.RegularExpressions.Regex.Match(row(“Product ID”).ToString, “[^A-Za-z]”).Value.ToString)
Then after invoke code, use write range activitiy to write the updated dt1
Hope it helps you
Regards
Nived N
Happy Automation
An alternative to invoke code would be this simple workflow:
System.Text.RegularExpressions.Regex.Replace(row.item(2).ToString, “[a-zA-Z]”, “”).Trim
More about regex you can find here: https://forum.uipath.com/t/regex-help-tutorial-megapost-making-your-first-regex-post-reusable-regex-patterns-regex-troubleshooting-sample-workflow-and-more/238791
Demo file: ExtractDigits.xaml (6.2 KB)
Best regards,
Marius
It worked but with an excel sheet of about 30 columns, I get this error:
Assign: Exception has been thrown by the target of an invocation.
you are missing to add data column or you are passing the wrong column index to the assign row.item()
Thanks!
If there is an option to change the solution, Please mark @Marius_Puscasu as the Solution…
I just highlighted the issue…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.