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 / Trouble with Power Aut...
Power Automate
Answered

Trouble with Power Automate Project Involving File Duplication and Deletion

(1) ShareShare
ReportReport
Posted on by 12

Hello,

 

I am currently working on a Power Automate project that involves the following steps:

 

  1. Duplicating an Excel file for backup (in SharePoint), then removing the first of two sheets in the file.
  2. Attaching the duplicated file (now only containing the second sheet) in a new email, and subsequently generating an .eml file.
  3. Deleting the duplicated Excel file stored in SharePoint.

In my attempt to execute the third step, I used the 'Delete File' action in Power Automate, but I encountered a 'bad request' error message.

 

I would appreciate it if you could help me troubleshoot this problem. Additionally, if there's a more efficient way to accomplish these steps, I am open to suggestions. 

 

Thank you in advance for your assistance.

Categories:
  • Verified answer
    sandeepstw Profile Picture
    312 Moderator on at

    Hi There,

     

    The 'bad request' error during file deletion in Power Automate usually results from incorrect file path or file ID. When using the 'Delete File' action, ensure you're referencing the correct 'File Path' or 'ID' from the previous action that created or duplicated the Excel file.


    If another process or user is accessing the file during deletion, it can cause issues. Ensure the file is not locked or in use. Ensure that the Power Automate flow's connection has the necessary permissions to delete files from the SharePoint library.

    You can also optimize Process using instead of duplicating the Excel file, consider using the 'Excel Online (Business) – Delete Rows' action to remove rows from the first sheet directly, thus eliminating the need to duplicate. After sending the email, if you need an .eml file, use the 'Create File' action specifying .eml as the file extension and using the email content as file content.
    Continue using the 'Delete File' action to remove the Excel file post-process, ensuring the correct file reference.

     

    Please give kudos and mark as solution if it helps.  

      

    Thanks, 

    Sandeep Mishra 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard