Timeout activity not working for reading excel

Hi all,

I have a process where I need to read a lot of Excel files (classic activities) as datatables to check specific info. It happens that I need to read the same file several times in a row (inside a for each row loop). Until some weeks/months ago, this was no issue.
But since those few weeks/months, we have issues with Excel sometimes, that, like in this case, it gets stuck at one file that could be read several times before in that loop. Maybe it didn’t close properly or whatever, but I used a TryCatch around this activity already. But it never throws an exception, it just gets stuck trying to read the file. I need to kill excel.exe from Task manager, then it can continue.
I wanted to use timeout, but that’s not available for Excel activities. So I used the Timeout activity from UiPath.Core.Activities and set it to 5 seconds. I surround it with TryCatch and in Catches, add a kill process activity and another delay.
But it still gets stuck. (noticed after 1 hour has passed) The Timeout activity does not throw any exception.
I think I remember that when I tested it on our Studio VM some weeks back, this approach has worked. But it doesn’t seem to work on our Robot VM.

So what could be the reason the Timeout activity is not throwing an exception after 5 seconds?

(On a sidenote: We encounter several issues with Excel being stuck or being unable to read Excel files stored on Sharepoint (Excel being “busy” and other errors) since said time. I will have to open different threads for those issues…)

Using these packages in Studio 24.10.1 (UIAutomation gave us several problems on version 24.xx.x; but I already tried higher versions as well, issue started occurring on lower versions of any package… so no, updating didn’t help)

Luckily, this specific issue occurs in a process we only execute once per month, so I still can intervene manually or let it run from Studio. But this should not be necessary…

Thanks for any hints.

Hi,

How about the following approach?

  1. Extract the process as another xaml
  2. Then call the xaml using InvokeWorkflow file activity with TImeout and Isolate option

Or it may also work if using Timeout scope and InovkeWorkflowFile with Isolate option.

Regards,

@Juli

  1. Is the issue with excel in local or sharepoint?
  2. In local try catch will not do anything as it would come into picture only when there is error…so better use a kill excel after or before a excel interaction starts
  3. For sharepoint better to use office365 activitirs and if someone is using the file at same time you would get that error

Cheers

I’m sorry for my late feedback. The process only runs once a month so I had to wait till the next input file came in.

And I didn’t change anything but it worked this time!
I highly suspect by now that someone had this specific file open while the robot wanted to access it, even though the robot accesses the file as “read only”.

The files are stored on a local server btw.

But I will keep this approach of extracting as xaml and invoking for the proper time-out in mind, @Yoichi , thanks!

@Anil_G
We also have issues with files on Sharepoint but unfortunately we are currently not allowed to use O365 activities by IT security settings. (But this will be a different thread soon.)

1 Like