Error due to Excel being used by another UIpath process

studio

#1

Hi, I have a workflow which started with a 1) copy file where I copy an excel from folder A to B, and then 2) read said excel with a read range 3) add data rows into the datatable 4) write said datatable back into that excel.

But occassionally I would receive an error in step 4 saying that the excel is being used by another process. I’d open the file manually right after the error but the file is not being used. I’ve also tried putting a delay of 10secs after step 1 and then it worked. But I’d prefer not to hard code any duration into the workflow, does anyone has any idea on how to know when an excel is not being used by another uipath process and only start processing after knowing the file is ready?

Many thanks.


#2

@inyourgravity
please try marking your excel as workbook.


#3

Hi @inyourgravity,

There are two types of excel activities in UiPath.

  1. Excel application Scope. Works in Foreground. If the Excel file is already open, then it takes the same excel file to work on.

  2. Workbook type.- Works in Background. Throws exception in case Excel file is already Open
    In case you want to read an excel file, even if it is open then please use “Excel application Scope” activities i.e the activities which come under “Excel” category in Activities panel.

Reference : Read range after write cell

I hope this will be helpful.


#4

May I ask why it is preferable to use excel application scope for reading excel file? I’d prefer it to work in the background instead of opening excel application though?

And the type I’ve used was the workbook type, so no excel was opened but i still received the error.

I’m now testing with writing range using excel application scope but it just freezes halfway through writing.