How to replace the data table value )

eg( in excel data is like 12344/cgvcv i want the final value as 12344)

Hey! Welcome to community…

Try like this

Assign strData = System.Text.RegulaeExpressions.RegEx.Match(InputVariable,"\d+").ToString

Regards,
NaNi

The datas are in excel sheet

Hi @Aarthy1

Read the excel file using Read range activity - Store it in the DT

Use For each row in data table activity

Use the expression

System.Text.RegularExpressions.Regex.Match(CurrentRow("Column name").ToString,"\d+").ToString

image

Regards
Gokul

Hey!

  1. Read the excel - Read range - Output as DtOut
  2. Take one for each row in data table pass the DtOut
  3. Take one assign inside the for each row
System.Text.RegulaeExpressions.RegEx.Match(CurrentRow(RowIndexOrColumnName).ToString.Trim,"\d+").ToString

Pass the above expression in assign

Now use add data row to write back the data to excel

In the array of row mention the expression like this

{CurrentRow(0).ToString,StrData,CurrentRow(2).ToString}

This will replace the data

use write range to write back to the excel

Regards,
NaNi

I write inthe same way , but it shows compiler error

Hello @Aarthy1

Welcome to UiPath community!

Try the below expression. Attached workflow for ref

Example.zip (10.2 KB)

(From r In DT.AsEnumerable
Let ra = r.ItemArray.Select(Function(x) x.ToString.Trim.Replace("/cgvcv"," ").Trim).toArray()
Select DTCorrected.Rows.Add(ra)).CopyToDataTable
  • DT is an original data table contains the excel data
  • DT Corrected is another data table that contains updated values

Input

Input

Output

output

This step is confused. Like this

I have attached the workflow @Aarthy1 Please follow that

Example.zip (10.2 KB)

Please explain in this method

Hey!

Try this:

Numbers.7z (53.2 KB)

Regards,
NaNi

Another the numbers are PC: F23E-A112-T677/gugh , here i want replace after “/gugh” value as blank .how to make it

Hey!

Try this…

CurrentRow(ColumnName).ToString.Trim.Split("/"C)(0)

Regards,
NaNi