Error: The process cannot access the file because it is being used by another process

excel
activities

#1

Hi guys

What could possibly be triggering this error
i make sure the file wasnot in use while the scrip was running

any ideas??

New KS ebilling has thrown an exception

Source: Private: Read range

Message: The process cannot access the file ‘C:\Users\u0159248\Desktop\Ebilli KS\BK PREW E-Billing Batch 6.xlsx’ because it is being used by another process.

Exception Type: IOException

System.IO.IOException: The process cannot access the file ‘C:\Users\u0159248\Desktop\Ebilli KS\BK PREW E-Billing Batch 6.xlsx’ because it is being used by another process.
** at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)**
** at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)**
** at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)**

Here my worflow looks like


#2

Hi Ivan,

See if this post helps:


#3

Hello!

The problem is that you’re opening the same Excel File at the same time. If you need to read the excel file again, just use the same “Read Range” that you used above, so you do not have to open it again :smiley:

Regards,


#4

I agree with @Lucas.Pimenta
Just delete the second one, because you only need to get the datatable before the ForEach one time:
image


#5

Hi @ClaytonM Thank you

I did that, but now I got another exception

New KS ebilling has thrown an exception

Source: Type into ‘Sold-To’

Message: Column ‘Soldto’ does not belong to table .

Exception Type: ArgumentException

System.ArgumentException: Column ‘Soldto’ does not belong to table .
** at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)**
** at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagastrong texttedException, ActivityInstance propagatedFrom)**
** at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)**


#6

Hi,

That error means that column name “SoldTo” does not exist in the datatable.
You can solve this by checking the Excel file to make sure there are no typos or checking the “Add Headers” checkbox in the Read Range properties.

Hope this helps.