Using an already open Excel workbook

Hi, I would like to know if anyone has ever tried working with an already open excel file.
Indeed, I have to use a web application which itself opens the excel file.
The “Excel Application Scope” activity does not work because it answers that the file is already open.

Thanks for your advices.

Kind regards

@Fred_PARENT

If it is a O365 version, then try O365 activities

Also can you share us from which source are you opening the excel

Any sample screenshots will be great for understanding your case

Thanks

It is Excel 2010 version.
It is a web application that opens the application and I tried Excel Application Scope activity from UiPath.Excel.Activities v2.9.3.

And the result is :
Excel Application Scope: Failed opening the Excel file \oat-gass-pp.intra.groupama.fr\DavWWWRoot\OATProsAuto.xlsb. Possible reasons: the file is corrupt, the file is already used by another process or you don’t have permissions to open the file.

Is there a way to work with open excel file please? My robot cannot open itself :frowning:

Regards

@Fred_PARENT

Are you able to download the xlsb file to your local machine?

if so You can try keeping a kill excel

so that the opened excel will be terminated and after that you can use the same in excel application scope

Hope this helps you

Thanks

Thanks for trying to help me @Srini84 .
Unfortunately I cannot do this. This excel workbook is locked and can only be launched from this web application.
If I kill it and reopen it it is corrupted and unusable.
It’s a tricky problem, isn’t it?

@Fred_PARENT

Can you try disabling Read-Only & Visible from the properties of Excel Application Scope?

As i didn’t see the url how it is opening in action, so i don’t have much inputs

Hope this helps you

Thanks

Deppending on your programming skils you may get inspired here:
https://www.codeproject.com/Tips/1080611/Get-a-Collection-of-All-Running-Excel-Instances

and here:
https://www.codeproject.com/articles/1157395/automate-multiple-excel-instances

This should allow you to get Microsoft.Office.Interop.Excel.Application of the running excel app started from the web application, which could be then used in ExcelApplicationScope

But do not ask me how to addapt it to your specific needs - I have no idea :slight_smile:

Cheers

@Srini84 I tried disabling Read-Only & Visible from the properties of Excel Application Scope but did not work.

Thanks anyway

@J0ska thank you for your inspiration, I’m a new UiPath developer.
But will try to ask a friend to help me with this ideas.

I have played arround with this a bit and this is the result.
BindToOpenExcel.xaml (9.9 KB)

Let me know if it helps.

Cheers

2 Likes

@J0ska thank you I tried to run your code and really thank you for this.
With an excel workbook I created it works so fine.

But with my project workbook, not

image

I think because it is an xlsb file with read-only access.

Regards

I success save as my project Excel on my local storage, and so it is in write mode but I think the problem is that it is a xlsb file.

I’m almost there !

@Fred_PARENT

Check as below

Hope this helps you

Thanks

I was testing this a bit.

I found that if you try access in UiPath using “Excel Application Scope” activity an excel file which is already open (using exactly the same path) then UiPath works with the one open => no need of extra handling.

If you access the same file but from different path (e.g. network drive mapped under different drive letter) it will fail with error you described above.

Cheers

@Srini84 thank you that was interesting but did not work with opened xlsb file. However I keep that code in my toolbox :wink:

@J0ska with your help, I found a solution. I send ctrl+s on my xlsb file to save it into xlsm file.
Then I use your magic code to catch it as a WorkbookApplication variable.
Finally I can use it as a common Excel file, it works so fine :slight_smile:

Many thanks and have a nice day !

Regards

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