Excel Scope Write Range "file in use" does not throw error

Hi all and devs,

Issue:

Using an Excel Scope, with a filepath in a variable, when the file is in use, the Excel Write Range activity is automatically saving the file locally to “C:\Users\<username>\Documents”.

Or am I going crazy?

I’m wondering if this is something anyone else is noticing.

Studio and OS version used:

image

Excel Activity version:

image

Workaround:

I will probably end up using Workbook Read Range to check if file is in use before entering Excel Scope so I can throw an error as desired.

Solution?

Assuming I’m not crazy and this is indeed a problem here are my solution Ideas:

  • I think the Excel Write Range should either throw an error when it is in use or (preferrably) change the filename to include a number like “directory\filename (2).xlsx” or “directory\filename (3).xlsx”

Thank you.

Clayton.

1 Like

@qateam @Gabriel_Tatu

tried with excel package 2.0.6526 (latest release)
if i have the same excel doc opened, the excel scope activity+write range, will write the data in it
there is no additional file created, anywhere :slight_smile:
can you share your wf?

I reproduced the issue in this workflow sample:
_TestCanvas.xaml (9.0 KB)

I opened the file on another machine so it is in use and the file got saved in documents folder instead:
image

I don’t see the update for 2.0.6526 on this server. However, my laptop has Excel 2.06526 and it did the same thing as shown above.

Thanks.

Can you manually open an excel document on machine2 while is opened by another user on machine2?

Yes, so I can open the excel file with multiple users or on different machines but one opens as read-only. I also verified that the Excel Scope is opening the file as read-only then writes file to local documents folder instead.

Interesting, i will check and get back to you here

I am using Excel Activities 2.5.1 and the file was not even in use by another human user but robot itself.

Is there a way for it to at least throw an exception?
Now, this goes undetected and we’d only realize that Excel was not updated after.

Hi @inyourgravity,
I think there might be an update to this in v2019, but until then there are few workarounds you can do.

If you use the Workbook Read Range, it will throw an error. So, one approach I have taken is to store an output filepath with an incremental number next to it. Basically, if “filename.xlsx” is in use then it changes the filename to “filename (2).xlsx”, and so on.

Here is a snippet with this approach using a Retry Scope:

Hey,

Could you test the behaviour with the Create New File property on and off for the Excel Application Scope?