Get Number Values from excel

Hi,
I have excel file in that MTR num include with company name, i want get only numeric values and paste into another sheet2.
example.

FilterNumber.xlsx (8.8 KB)

i have attached excel file.

can anyone help about this ?

1 Like

regex with pattern \d+ will extract the numbers for you

ensure System.Text.RegularExpressions is imported

  • build datatable activity - 1 Column - dtCCodes

Assign activity
left: dtCCodes
Right:

(From d in dtData.AsEnumerable
let cn = Regex.Match(d(“MTR NUM”).toString, “\d+”).toString
Select dtCCodes.Rows.Add({cn})).CopyToDataTable

then write this datatable to other sheet with a write range

1 Like

Hi
Hope the below steps would help resolve this

  1. Use a excel application scope and pass the file path as input and get the output with a variable named dt using read range activity

  2. Then use a FOR EACH ROW activity and pass dt as input

  3. Inside the loop use a assign activity like this

CurrentRow(“MTR NUM”) = Split(CurrentRow(“MTR NUM”).ToString,” “)(0).ToString.Trim

  1. Now that dt will have numerical value

  2. Use a write range activity to write it in another excel

Cheers @Anand_Designer

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