Even after putting excel in try block, it is not catching exception

it is getting stopped forcefully even after i have handled it well. What could be the possible reason?

hey

it means that you have your workbook open, so it will fail, close your excel and try again

regards

Hi @ydash999

Please use “Kill Process” Activity before using Read Range and pass the value as “Excel” , this issue is caused when the Excel file is already opened,

also please mention “IO Exception” type in catch block

thanks.

i have opened excel file knowingly to get exception, and used exception as well as io exception so that i can get the exception message in log message,but instead, it is abruptly getting stopped! what is the use of using try catch then?

i have knowingly done to get exception message, but instaed it is getting abruptly stopped , not smoothly executed

Please find the attached xaml, pass the excel file path ,open the excel file and execute in debug mode and do a step into to check where the flow goes.

Sequence.xaml (7.2 KB)

thanks.

1 Like

Hi @ydash999,

If you are using excel on and off repeatedly, such problems can occur. Even if you close it manually, excel may appear in the task manager. Therefore, you can set a kill activity before reading the excel.

Regards,
MY

your file has run smoothly! i have exact configuration, still my process stopped abruptly. why?

Please create a New Sequence and try again .

Thanks

HI @ydash999 ,

Instead of catching “io exception” use parent exception “Exception” class.
and use if condition in catch block for that particular exception message which you want to handle. and in else condition use rethrow
Ex.
Catch -“Exception”
if (error.message.tosting.contains(“The process can not access the file”))
{
do something
}
else
rethrow.

it is clumsy way but you can try as IOException is not working

I have used exception also. still it is abruptly getting stopped bro

tried bro. still same error system.io exception. your workflow is working fine , but same workflow of mine is not working. i dont know why

i created new workflow and tried. it worked now! thankss all

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