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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate Flow L...
Power Automate
Answered

Power Automate Flow Loses Connection to Excel File After Replacement

(2) ShareShare
ReportReport
Posted on by 5

Hi everyone,

I'm facing an issue with my Power Automate flow that triggers an Excel script. Generally, the flow works fine, but whenever I delete the Excel file at the storage location in a Teams channel and replace it with a new file (with the exact same name and location), the flow fails to find the Excel file to run the script.

To get it working again, I have to go into the flow and reconfigure the file path in the "Run Script" action. This solution works temporarily until I replace the Excel file again.

Has anyone experienced a similar issue or have any suggestions on how to resolve this? Any help would be greatly appreciated!

Action 'Run_script_from_SharePoint_library_-_Deviation_Data_auslesen' failed: The file format is not recognized. Please check that the selected workbook is valid.

 

Thanks in advance!

Categories:
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,442 Super User 2025 Season 2 on at
     
    Overwriting the file would be ok and its file identifier wouldn't change, but when you delete it completely it changes. You have to simply replace the file not delete it, so that it keeps the same reference.
     
    That, or you have to modify your flow so that you dynamically get the files unique Id and plug that dynamic property in.
     
    Option 1 (see option 2 lower down)
     
    Since this is SPO you can use Get Files (Properties Only)
     
    Then use an Apply to each to loop through them
    Inside the Apply to each you would check with a condition if the
    FileLeafReq eq 'yourfilewithextensionnamehereOrEnvironemntVariable'
     
    in the yes side, run your script, in the no side do nothing
     
    Now you can delete the file and not worry about your flow
     
    Option 2
     
    You can build a filter query directly into the Get files so that you do not have to use an Apply to each
    Click Show Advanced
    in the Filter query add the
    FileLeafReq eq 'FilenamewithextensionOrEnvironmentVariable'
     
     
     
    NOTE, my suggestion with Environment Variable would be to have you set the file name there and not hard code it in your flow but its not required if you just want to hardcode the file name.. I dont suggest it, but you can.
     
    Either option will fix your issue.
     
    If this resolves your issue please mark the answer a such thank you!!!
  • JB-09081405-0 Profile Picture
    5 on at
     

    Thank you so much for your detailed response and the time you took to help me out! Your suggestions were very insightful.

    While I was experimenting, I stumbled upon another solution that worked for me. Before running the script, I added the action "Get file metadata using path." Then, I used the dynamic content of the file path as the Workbook path in the "Run script" action. This resolved the issue for me.

    Thanks again for your assistance and valuable input!

     

    best regards,

    Jannik

  • Michael E. Gernaey Profile Picture
    53,442 Super User 2025 Season 2 on at
     
    I am so happy you have it fixed :-) 
     
    have a great rest of your day and week :-)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard