How to read and replace specific text in the opened file?

Hi All, Greetings for the day!
Need help to automate below scenario.
1- Download a txt file from a website (chrome).
2- Open it from Download bar.
3- Read and Replace specific text in the opened file.

Any sort of help is highly appreciated.
Thanks

Hi @Tarun_K

  1. After downloading the file
    use read text file activity to read the text file and store in string_1 variable

now for example, if u need to replace “Android” in text file with “Iphone”, do as below

string_1.Replace(“Andriod”,“Iphone”)

Hope it helps

Regards,
Nived N

Hi @NIVED_NAMBIAR , read text file activity requires file location. Is there any way by which I can avoid this?

Yes , either u can specify the file path from download folder or make your process such a way that it download to specific folder within your workflow itself [changing setting in chrome help to acheive this]

Regards,
Nived N

Sure. This means if I need to read/write a text the I must provide the file path and there is no other way?

yes @Tarun_K

1 Like

Hi @Tarun_K

Please explore the Wait For Download Activity. It will be very useful in your scenario.

https://docs.uipath.com/activities/lang-en/docs/get-last-downloaded-file

1 Like

Thanks @kumar.varun2, file is being downloaded without any issues.

Scenario it to read and replace specific text in the opened file without providing the file location.

@Tarun_K

The variable passed to the Wait for download activity holds the path information of downloaded file also. That is why I suggested you to explore it.