Replace string in excel

Hi team,

I want to replace “-46546” this string in excel with “P0” string.
This string will be present in row(0) in excel on multiple times.


1 Like

Hi @sshitol
If you can install package “BalaReva.Excel.Sheets.FindReplace”, then it will be easy for you to find/replace

1 Like

Hi @sshitol

Use the below steps…

  • use read range to read the excel into a datatable.
  • use For Each Row to loop through each row of the data table
  • within the loop use an IF activity to check for the specific value

If row(0).ToString.Equals("-46546")

  • now in the Then segment of the if condition, use assign activity to replace it
    Row(0) = “P0”
1 Like


This condition will check if complete row(0) is equal to “-46546” and not part of the string per the requirement.

this assignment will replace all of the string in row(0) with P0, instead of part of it, incase it finds a matching string “-46546”.
Please correct me if Iam wrong.



Oh yeah… thanks for pointing it out :slight_smile:

Yep… it will check the whole string for the value. So if we want to see if the string contains the value somewhere… we can use below


Yep… correct… so for that we can use string replace
Row(0) = Row(0).ToString.Replace("-46546",“P0”)

Thanks again bro for correcting :slight_smile:


@Lahiru.Fernando Thanks man.:+1:

1 Like