web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate: "Delet...
Power Automate
Suggested Answer

Power Automate: "Delete File" Fails Due to Locked File Error

(1) ShareShare
ReportReport
Posted on by 20

Hello,

 

I'm facing an issue in Power Automate when trying to delete a file. After using the "Delete file" action, I get an error stating that the file is locked.

Here's the process:


  1. I retrieve a file from SharePoint, which is used as a template.

  2. The file is moved to OneDrive.

  3. An Excel script runs on the file in OneDrive.

  4. The file is then moved back to a SharePoint folder.

  5. I try to delete the temporary file from OneDrive, but I get a file locked error.


  6.  

A workaround would be to keep the template in OneDrive, but the users prefer not to have it stored there.

 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,960 Moderator on at
     
    Before you delete, add a Wait action. Since its excel this happens a lot in many scenarios.
     
    Add it to be 3-10 minutes (ugg yeah 10 minutes) and it should go away.
     
    Wasn't sure if you already resolved this or not.
     
    If this helps you, if you do not mind Marking it as such and maybe a like. :-)
     
    If you have further questions, please let me know.
  • AN-04030826-0 Profile Picture
    20 on at
    Hi @Michael E. Gernaey,
     

    Sorry for the late reply. I’ve already tried, even waiting up to 10 minutes and also using a loop to wait for an hour — but it still didn’t work.

     

  • HC-05020715-0 Profile Picture
    4 on at

    Hi @AN-04030826-0,

     

    I don't know if you found a solution for your problem, but I did find a way to force delete the file in the OneDrive folder. There is a thread titled "Unlocking OneDrive file through API" that describes the steps. You can check it out here:

    https://community.powerplatform.com/forums/thread/details/?threadid=c012cc48-22c4-4f1a-aec9-c03f6832ba20

     

    The bonus is that copying from OneDrive to SharePoint can be done just with the Copy File connector from SharePoint. :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard