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 / Office Script Returnin...
Power Automate
Answered

Office Script Returning File Format Error

(0) ShareShare
ReportReport
Posted on by 20

Hi Power Community!

 

I have a flow which takes an email attachment (.XLSX) and saves it to a SharePoint folder and grabs some metadata. I then have a condition which checks that the file is indeed the correct format, and if so, run an Office Script that functions normally when run manually. However, when running the Script via the flow, I receive a BadRequest error:

 

 "message": "The file format is not recognized. Please check that the selected workbook is valid.
 
I know it's valid because I can open the file manually both with Excel Business and the standalone app, and the condition returns "true" for verifying the file type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
 
I felt that it might be too soon after file creation and that the server might need time to "load" the file so to speak, so I added a two-minute delay before the script runs, with no change in error message. Please tell me what information I need to provide for troubleshooting. Any ideas would be greatly appreciated.
 
Unlighted7406_0-1698258138853.png

 

 
Categories:
I have the same question (0)
  • Verified answer
    Unlighted7406 Profile Picture
    20 on at

    Solved! Apparently, the Office Script connector is expecting an identifier that includes the file type even if the file explicitly has the extension in the name and a condition has already confirmed the correct type. Swapping out the dynamic content "name" with "id" made it work, and no delay was required. 

  • dquintanilla Profile Picture
    2 on at

    Could you elaborate on how you fixed this? I am having the same problem, but I don't completely understand the solution

  • tjlyons Profile Picture
    10 on at

    So instead of using a dynamic name (whether it's a variable or collected from a "get" action), you need to get the "id" of the file you want to modify.  In my case, I was creating a new file and using the variables for the new filename.  When I retrieved the "id" from the results of the create file action, it worked:

     

    tjlyons_0-1702680510744.png

     

     

  • sami_mrs Profile Picture
    20 on at

    It is very strange about getting the following error when using run script action in power automate.

     

    The file format is not recognized. Please check that the selected workbook is valid.
    clientRequestId: 727360b6-ef5e-4a52-aaf4-098539b6384a

     

    There is no solution found. Some Excel files works well. Some Excel Files do not work and show the above error. 

     

    Here I have seen only vague solutions. Nothing is useful. 

     

    It is wasting time to use Power Automate for setting flow for some part of work. 

     

    Also, not have any proper way of content from Microsoft about debugging issues. 

     

     

     

  • sami_mrs Profile Picture
    20 on at

    Your suggestion is not useful. Till Getting same error

  • sami_mrs Profile Picture
    20 on at

    using id is not a solution. it is also throwing same error. 

  • netptl39 Profile Picture
    4 on at

    Solution: move the .xlsx to a shsareoint site with a smaller number of files. 
    I had a flow working perfectly and one that didn't. 

    Once I migrated to a smaller site the automation started working on first test. 
    My guess is that the searching for the file ID "times out" either becasue of the high number of files or depth of the location. 

  • prashantch Profile Picture
    4 on at

    Hi All,
    I have faced the similar issue,  and found the solution, below is the link my possible solutions.

    Thanks

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard