Use Retry Scope to check excel file

Dear all, I want to use “Retry scope” to wait the system open a excel file. how to set the condition to let the UiPath to check whether have an open excel file?

thank you so much~

Hi @anishakotian400

I would recommend using a try-catch in this situation like you mentioned. The try block should contain the workbook read range activity. The Catch should be for System.IO.IOException.

If the file is open, then it will throw the IOException and will move into your catch block and perform any activities you put there. If it is not open, it will simply move onto the next activity outside of your try-catch block.

Hope it helps!!

@uidn0497

Welcome to the community

How are you opening the excel? Are you not using the built in excel activities? If no is there any specific reason to not use? As the built in activities will automatically wait till open and only then activities are performed

cheers

Hello Gorthi, i am using the UiPath to operate SAP to download data to excel file. the SAP will automatic open the excel file when it finish the download. i want to ask the UiPath to close the excel program. it will take some time from downloading to opening the exel file. i do not want to use “delay” because the time is not fixed.

Hello Kankatala,

thank you for your recommend. However, i think using “try-catch” can only make a time checking, my purpose is to wait until the UiPath find an excel file is open. If it is not open yet, uiapth need continue to wait until an excel file is open and then proceed to the next action.

In that case, use file exist activity it decides that file is available in the specified folder or not, it will give the Boolean output, then take an If condition to check the boolflag and kill the excel process.

Hope you understand!! @uidn0497

@uidn0497

You can give a big timeout value for the close click so that it waits till the excel close is present

or another way would be to use check app state with timeout and then throw error if not found else click on close

cheers

@uidn0497 simply put your excel scope in retry scope

i set number of retires = 10
retry interval = timespan.FromSeconds(5)
this means if it fails (cant find excel file etc…), it will wait 5 seconds then retry (total 10 retries)

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