FIie is being used by another process

Hi All,

I am unable to delete an excel file via executing multiple transaction item since i am reading the values from excel to send an email. I am getting an error as “File is being useds by another process”.
Can someone suggest the best way to deal with this?

Hi @Riya_Ojha, welcome to the Community.

The excel file must be open in the background while the process is trying to read the data from it.

You can either manually close the file before executing the process or you can close the file programmatically using Kill Process activity in the process before the file reading activity takes place.

Hope this helps,
Best Regards.

@Riya_Ojha

Welcome to forums

Check while attempting to send the email, the file completes and reading and closed properly

If you are unable to find that still then you can use Kill Process activity and write Excel
So before attempting to send the email It will kill the Excel instance and send the email

Hope this may help you

Thanks,
Srini

Hi @Riya_Ojha ,

Could you let us know where have you placed the Delete File activity ? Is it inside the Excel Application Scope or Use Excel File activity ?

If you are using it outside, you could maybe use the Kill Process activity to kill the excel related processes and then perform the Delete operation.

I am trying to avoid kill process, since it is killing in both the PIP and in the main session. Is there any other way to do handle this just in PIP?

I am using it outside the excel scope but kill process kills again both in PIP and Main Session

Hi @Riya_Ojha

Please try using Read Range Workbook Activity present in System>File>Workbook>Read range Workbook As this activity doesn’t open the excel application while executing the multiple transaction item.

Regards

You could try setting AppliesTo = OnlyCurrentSession in Kill Process activity arguments:
image

If you are using excel application scope, please use close workbook activity to close the instance gracefully. You may have to create a variable of the workbook instance and pass the same to the close workbook activity.

Please note the close workbook activity should be called outside the excel application scope.

Also add in a small delay between close and delete activity.

Hope this helps.