Because it is being used by another process

System exception.The process cannot access the file ‘*\Incumbent and organizational matching report.xlsx’ because it is being used by another process. at Source: Copy File
When I use a copy file to copy a file of UiPath project file with OC, show this error, does any one met this issue?

@jmy See if the file is already open or not

Also add Kill Process for excel keeping continue on error as True. This will fix the issue if it is open in your machine. if it is opened from shared folder - Kindly try to open manually to see whom it is using

Try to add kill activity and also add some delay

Is there any operation performed on file by code before copy activity
If yes adding kill and delay will solve your issue

U can keep copy activity in retry scope also

@jmy

If code is not accessing file, check who is using as mentioned by @sharazkm32

Hi @jmy,

Yes we have also faced similar scenarios sometimes.

These basically happen in below situations:

  1. file is actually in use by some other user - if shared file.
  2. you are trying to perform multiple operations on same file. For e.g. a) copy file from lan drive to local b) after copying, open the file and perform some operations. Now these steps looks right when dine manually but when bot does it, many times it can happen that file transfer was still in progress and not is already at step b) trying to town the file and perform operations on it.

Solutions:

  1. have proper delays between such activities when performed in same file.
  2. have a check if any excel instances are open, then close all instances of previously opened excel workbooks before opening new ones. Have the excel workbooks closed specifically for different excel application scopes.
  3. for scenario mentioned in above problem statements, have a check - if file exists at the required location then proceed with further operations.

Hope this helps.

Regards
Sonali