How can i extract only string from column A and write to columnB?

ComparisionReport_TR_COSUM_0201055167CX01.xlsx (11.9 KB)
eg-Opportunity ID: 0201055167CX UNITS: 01
output-OpportunityIDCXUNITS

@Aparna_30

Follow the steps

  1. Read the data into a datatable dt
  2. Use for each row in datatable activity
  3. Inside the loop use currentrow(1) = System.Text.RegularExpressions.Regex.Replace(currentRow(0).ToString,"[^A-Za-z]","")
  4. After loop use write range and write the data

Note : if second column is not already present then after step 1 use a add data column to add one more column

Cheers

1 Like

Hey @Aparna_30 ,
You can use Regex to satify your use case

For example
input str: Opportunity ID: 0201055167CX UNITS: 01
regex pattern: [A-za-z]+
Output:

Hope it helps you!

Hey @Aparna_30, you can use regex β†’ [A-Za-z]+ or [A-Za-z]*

The below XAML will give a demo of the work,
Main.xaml (9.7 KB)

@Aparna_30

Read range activity
For Each Loop
MyString=CurrentRow(β€œTest”).ToString
ReplaceSemicolon=MyString.Replace(β€œ:”,β€œβ€)
ReplaceSpace=ReplaceSemicolon.Replace(" β€œ,”")
outputString = System.Text.RegularExpressions.Regex.Replace(ReplaceSpace, β€œ\d”, β€œβ€)

I hope This will help You

Hi @Aparna_30

=> First use the use excel file activity inside it use the insert column activity to insert the column
=> Use read cell value activity to read the cell in the excel file.
=> Use finding match patterns activity to extract the output from cell value.
=> Use for each to iterate the matches output and concatenate to a variable.
=> Use the Write cell activity to write the output value in to the column B

For regex expression find the below image
image

Find the below workflow for your reference
Browser_Practice.xaml (15.2 KB)

Check the output below

Note - Change the path in the Use excel file activity.

Hope it helps!!

1 Like

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