Excel row data has unwanted data how to remove

Hi,

Excel row has some unwanted data how to remove the substring and continue with the required data.

If the string has date and followed by some characters means that needs to be removed.
The above attached text file is first row data of excel.
Please help me.

Thanks & Regards,
Lakshmi

refer to this
Excel.xaml (7.0 KB)

assuming txt is your excel text, assign
system.Text.RegularExpressions.Regex.Replace(txt, "(?m)([\d]{1,2}-[A-Z][a-z]{2}-[\d]{2}.*?$)", "")

to newTxt (string variable)

then write newTxt to another file
result:

@jack.chan, The above solution worked thank you and how to remove unwanted spaces multiple lines.

Thanks,
Lakshmi

1 Like

@jack.chan ,

How to remove multiple blank lines in the text file.

Thanks,
Lakshmi

Excel.xaml (8.9 KB)


Not able to remove the blank lines.

Hi @lakshmi.mp ,

If you want to have the Output in the above manner, then you could use the below Expression :

textStr = System.Text.RegularExpressions.Regex.Replace(textStr,"(\r?\n){2,}",Environment.NewLine+Environment.NewLine)

Here, textStr variable contains the output of Read Text File Activity, we modify the value in the same variable and assign to the same variable, you can then use Write Text File Activity to save the value in a text file.

1 Like

because those were originally there, you want them removed as well?

@jack.chan , yes want to remove unwanted blank lines.

1 Like

@jack.chan Thanks a lot .

Its working now.

Thanks & Regards,
Lakshmi

1 Like

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