Excel Application Scope: Failed opening the Excel file . Possible reasons: the file is corrupt, the file is already used by another process or you don't have permissions to open the file

I am trying to process 1 file inside a folder. This file will be removed after processing it. Then a new file saved will be saved inside that folder. The file name is dynamic. Every time I run the script I always get this error. I appreciate your assistance.

Attach is the xaml of the script I’m working on.

Main.xaml (6.6 KB)

3 Likes

Welcome to uipath community
it seems like excel file is open when you run this xaml file , close it before running this on your computer.
Also check whether its accessed by someone while you run this file

1 Like

I am 100% sure that the excel is closed when I run the script.
I’ve done it a couple of times. That script will actually work if i put the exact file path but if it contains a dynamic variable it won’t work.

@VegitlX_HuNteR
excelClose.zip (13.4 KB)

Try this out

First of all you need to add your excel scope in for loop and also need to close same in side for each coz you open an excel application close but you never close it.

Hi @apurvalost

I tried to do the for each and the same exact thing that you did and I keep getting the same error.

image

Error log:

I followed some of the posts here in the forum. It seems that this is a common issue that is being encountered if you use excel scope.

@VegitlX_HuNteR -

  • can you copy the xmls file from desktop to other drive like D:\test\test1234.xlsx
  • pls verify the file attributes and uncheck read-only option.
  • before starting the process - use kill process and pass excel.exe
2 Likes

use delay of 5 seconds before closing application , if you still face issue then it use kill process after delay.
Root cause is excel.exe is running in background you can check your task manager for same, so our goal to close excel application from uipath robot agent and make it work.,

I was facing same, replaced excel scope with Workbook. It worked

I am also facing same issue. Tried with creating new file, closing all excels ,restarting server etc but all failed. Does anyone knows why it is coming and what could be the possible solution?

Thanks

Also have same issue, looks like, a Uipath bug. Are there any solutions?

I encountered the same problem, seems like you can’t use a lot of operations in the path text editor of the Excel App Scope activity.

The problem got solved when I assigned the path in a string and directly place the string as the path in the Excel App Scope activity.

Hello,

I had the same issue: "Excel Application Scope: Failed opening the Excel file … Possible reasons: the file is corrupt, the file is already used by another process or you don’t have permissions to open the file. "

My solution for this issue was to kill the process UiPath.Service.UserHost.exe from Task Manager.

After that, the message was gone and the Excel Application Scope activity was OK.

2 Likes

HINT

I spent many hours on this… Now I know, that Excel application scope is not compatible with background job. Please, check if you have Starts in Background selected as No.

If you have xlsx filetype, then use System/File/Workbook/ activities, not App Integration/Excel/ activities if you wan to have background job.

Hopefully this helps.

3 Likes

Dears,

I hope that this thread is still being read by people having the same problem. Please also check if your drive is not full or whether it has enough space to read your/open the excel file. I experienced this and after cleaning out my drive, it works again.

I have the same problem. It was not there before and now it is. I didn’t change the design and it stopped working. Massacre. Uipath 2022.04

1 Like

As an alternative way, please check the path. The file may not be in the location you are looking.

Best

I had the same issue I solved it by letting the bot save the file with a different format - .Replace(“.xlsx”,“.xls”)

Hey @ apurvalost

I’ve had the same problem recently. I solved it by checking the Read-only property on the Excel Scope Activity. In my case, I don’t need an excel file update. I’m using Uipath 2022.04 Community Edition.

Cheers

Hello team
I have getting this error please help me
Possible reasons: the file is corrupt, the file is already used by another process or you don’t have permissions to open the file. "

One reason could be the length of the File. If the length of the File name including path is more than 256, it throws this exception. Try renaming the file to fit within 256 chars