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)

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