Find and Replace in Excel

Hello all, if I am working in an excel database and need to change all instances of a year to the next year (for example change all instances of 2018 to 2019) how would I go about doing that?

1 Like


If you are looking to do the operation in datatable, first of all convert the datatable to string by using “Output Datatable” activity.
Then add a “Replace” activity with input(output of ‘Output Datatable’ activity), Pattern(“2018”) and Replacement(“2019”).
Use ‘Generate Data Table’ activity with input(output of ‘Replace’ activity) and pass it’s output datatable to write an excel file.
Hope this will meet your requirement… :slightly_smiling_face:

Warm regards,


If you want to do the replacement other than datatable method, you can achieve it in a single step by using VBA.
After the ‘Read Range’ activity inside the Excel Application scope, add “Invoke VBA” activity and add the code file (341 Bytes) (.txt file)
Give the EntryMethodName as “FindReplaceAll”
#Using this method, the operation will be carryout directly on your source excel file.

Warm Regards,

@ nimin , Hi
where i need to add the VBA code ( in the invoke VBA
the code inside the Zip file , where i need to add it in the uipath ?
thanks very much

Hi @nimin
new to uipath
i have also similar scenario
need to change the 0 with No and 1 with Yes in Expedite Column.


can u please suggest some steps.




1.Read your Excel and store into a Datatable Dt1
2.use For each row in Dt1
3.use Assign activity,create a variable var1=Cint(row(“column name”))
4.use if condition if var1=0 in Then use assign to set No and in else assign Yes
5.use Add Data Row to add each row to DT
A Manohar

thanks for your quick reply @Manohar1
i hv done like this in if condition.
pls have a look

how sud i add each row to DT by add data row??

Many thanks



use Build Datatable to create a DT where declare the columns you want to create
In Add Data Row just in Array row pass values as below

A Manohar

do i need to create all coulmns in build data table which are present in excel sheet??

If you want to print only a specific column then you can build table with that specific column as per your requirement.

yes ,just want to modify that particular column with 0 to no and 1 to yes
want to keep all columns and data as it is.
that’s it.


use append range activity and maintain the specific range of column you want to change. and declare data table in it
it will change automatically with the new values

many thanks @Manohar1
it worked as u suggested…
but couldn’t change the value 0 to no and 1 to yes
as i attached the screenshot above for replacing the value…
i m doing wrong somewhere.
pls guide…


unable to find screenshot

for your reference i will do an example and will share xaml file

sure manohar

First read your excel sheet using the read range activity and then assign a datatable variable for it.Then create a for each row activity for that data table and inside that for each activity put an assign statement as. row(“column name”)=row(“column name”).toString.replace(“0”,“no”).trim
and another assign activity as row(“column name”)=row(“column name”).toString.replace(“1”,“yes”).trim
Then you can write that data table into an excel using write range activity.:slight_smile:

hi vishal

after putting assign activity in for each row.
what data table u r talking about??
sud i create build data table and then add data row…
bcz as manohar suggested that procedure worked except yes /no conversion…
m attaching xaml file…
pls have a look…
demoProcesses.xaml (19.4 KB)
thanks for help…


ref.xls (17 KB)

Main.xaml (10.7 KB)

1 Like

The data table which you performed for each activity.
use the same data table in the write range.

1 Like

got it

Thank you so much!