Skip to main content
Solved

Unable to delete excel file

  • April 12, 2024
  • 4 replies
  • 509 views

Forum|alt.badge.img+6

As part of automation I create 6 excel files in the working folder. I delete the files from the working folder before every run. This works 90% of time but 10% of time the bot fails at the delete step.

There are no files in the folder in the folder. I rerun the bot and I get the same error until I restart the machine. I have created a test bot to show the steps.

Error : File:com.automationanywhere.botcommand.exception.BotCommandException: Unable to delete the file(s) 'C:\Automation Anywhere\Management Reporting and Planning\Working Folder\~$EmpManagerMapping_022024.xlsx' because access is denied. - 16

 

Best answer by Sai Deepan.R

Can this be an issue since I am deleting simultaneously 

View original
Did this topic help answer your question?

4 replies

Tamil Arasu10
Most Valuable Pathfinder
Forum|alt.badge.img+16
  • Most Valuable Pathfinder
  • 3274 replies
  • April 12, 2024

Hi @Sai Deepan.R ,

Please try the below steps to fix this.

Check File Permissions: Ensure that the files you're trying to delete are not being used by another process or program. Sometimes, a file might be locked by another application, preventing it from being deleted. You can try closing any applications that might be using these files and then attempt to delete them again.

File Handle Release: Ensure that your automation script is properly releasing any file handles it might be holding onto after reading or writing to the files. Failing to release file handles can sometimes prevent files from being deleted.

If the file used any where/ subtasks, please make sure to close the excel session.

Delay Before Delete: Introduce a small delay before attempting to delete the files. This can give any processes that might be using the files enough time to release them before your automation script tries to delete them.

 

 

 

 

Forum|alt.badge.img+6
  • Author
  • Navigator | Tier 3
  • 16 replies
  • April 12, 2024

Thanks @Tamil Arasu10 for the reply.

The file doesn't exist in the folder so there is no issue with the permission or file release as per my knowledge. If condition does file exists returns true even when there is no file in the folder. This gets fixed when I  restart the machine. I think this could be something to do with temp file reference ?

Error : File:com.automationanywhere.botcommand.exception.BotCommandException: Unable to delete the file(s) 'C:\Automation Anywhere\Management Reporting and Planning\Working Folder\~$EmpManagerMapping_022024.xlsx' because access is denied. - 16


Forum|alt.badge.img+6
  • Author
  • Navigator | Tier 3
  • 16 replies
  • Answer
  • April 12, 2024

Can this be an issue since I am deleting simultaneously 


Tamil Arasu10
Most Valuable Pathfinder
Forum|alt.badge.img+16
  • Most Valuable Pathfinder
  • 3274 replies
  • April 12, 2024

You're correct.

The session ends when you restart the machine. After that, it works fine.

 

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings