MS Excel. Overview. Cannot access the file because it is being used by another process

Hello everyone!

So, I already know the main reasons why some executions can return the error message “The process cannot access the file because it is being used by another process.”. In my case, with MS Excel.

My questions are:

  • How big is the difference between using UiPath.Excel.Activities.ExcelWriteCell inside of a UiPath.Excel.Activities.ExcelApplicationScope vs. UiPath.Excel.Activities.WriteCell directly?
    1. Does the latter have always the possibility of not closing the Excel quick enough before another activity is going to use that same Excel file?? Can quick enough mean there is no chance? Like the process is going to stay open…
    2. Is it random? What it depends on?
    3. Will the Scope with ExcelWriteCell within it will guarantee the closing of the respective Excel file process and that my next activity using the same Excel file will work ok?
    4. Are the Kill and Close application activities a better or as good solution as the “scope limiting” solution?
    5. Are delays necessary?
    6. Anything on Windows 10 affecting this problem? (I ask this because sometimes the Excel license recognition is not working 100% properly)

What is your experience on this?

Thank you!!

1 Like

hi and welcome to the community!
you cant use that outside excel scope, what you can do if your specs permit is use System->File->workbook activities which are faster and dont lock the file.

System -> File -> Workbook -> Write Cell is the same as UiPath.Excel.Activities.WriteCell.

And the other one (the first I mentioned) is the one where you have to use the scope.

That’s exactly the comparison I made, and the questions come after that, and other questions as well.

Thanks!

i deleted so i dont disturb others that try to help you.

Hi SAFE,

I have the same concerns with you. Did you find any solutions for this?
In my case, I use append range activity (without using excel app. scope) inside for each activity, it sometimes popup error that cannot access file bcs it is being used in another process.
I don’t know how to solve this issue completely.
Please share with me if you find the solutions.

Thank you very much

Hi… Did you find the solution? I am having the same problem I tried a lot but couldn’t find any solution. I am having the same problem

“The process cannot access the file because it is being used by another process.”. In my case, with MS [Excel]

Hi Asharma,

I cannot find the reason yet. However, instead of using append activity in for each activity. I use build table, then add data row activity and lastly append the final data to an excel file. This will avoid read-write exception.

Hope this help you,

Thank you