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 / cannot run script from...
Power Automate
Unanswered

cannot run script from library

(2) ShareShare
ReportReport
Posted on by 76
Had this working very well for some time.  Now, all flows with any "Run Script from library" fails.
 
Simple script.  (Return a couple of cells back to power automate)
 
result
 
Action 'TryGetExcelData' failed: The file format is not recognized. Please check that the selected workbook is valid. clientRequestId: ab4ccfbe-d542-4946-afd4-7c391c5627c0
 
Now, the script runs in desktop and excel just fine.
 
Just not Power automate.
 
Suggestions ?
Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    Could you please share an image on how did you configure your Run scripts from library action?
  • RG-27121653-0 Profile Picture
    76 on at
  • RG-27121653-0 Profile Picture
    76 on at
    Additional info to the pic.
     
    The "Script" was in a "Condition" checker (The StatusDraft)
     
    The condition just checked if the file was in the correct status
     
    Same error, so I moved it out of the condition, just below.
     
    Same error.
     
    Again,   Script runs fine from Excel, Desktop flows.   I even changed script from library (As above) to run script from excel. 
     
    Same error
     
     
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    Thank you for the additional context. Based on your image, I cannot see any clear issue with you action setup. Maybe the problem is the dynamic content for the Workbook input. 
     
    What SharePoint action are you using to get the Excel file? I ran a test from my end with the Get file metadata using path and it ran successfully:
     
     
    I will try to replicate the flow with the same action that you used to get the Excel dynamic content. 
     
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
     
  • RG-27121653-0 Profile Picture
    76 on at
    Trigger as follows.  
     
    Sharepoint File is created,  (Properties only)
     
    int var ....... ad nausum
     
    Then check if "List" field DFT Status is in "Ready"
     
    Not "Ready", bail (Set error codes)
     
    True, (Was try script)
    now
    True, (just continue)
     
    At first, I thought it was cranky about the workbook id, but I am asking to run a script from a library.
     
    Offending script attached.  (No secret code)
     
    [------------ Script begin ----------]
    {"version":"0.3.0","body":"// Robins Updated Script Code\n\nfunction main(workbook: ExcelScript.Workbook) {\n  // Get the active cell and worksheet.\n  // let selectedCell = workbook.getActiveCell();\n  let selectedSheet = workbook.getActiveWorksheet();\n  // CellA1 = Client\n  let ClientA1 = selectedSheet.getRange(\"A1\").getText();\n  // CellC1 = Date\n  let DateC1 = selectedSheet.getRange(\"C1\").getText();\n  // CellE1 = Ticket #\n  let TicketE1 = selectedSheet.getRange(\"E1\").getText();\n  // CellB3 = Employee Name\n  let EmployeeB3 = selectedSheet.getRange(\"B3\").getText();\n  // CellB6 = Project Manager\n  let ProjectMB6 = selectedSheet.getRange(\"B6\").getText();\n  // CellE3 = SA Project Number\n  let SAPNE3 = selectedSheet.getRange(\"E3\").getText();\n  // CellE6 WA Number\n  let WANE6 = selectedSheet.getRange(\"E6\").getText();\n\n  // Robin:  Format as JSON and output\n\n  return {\n    Client: ClientA1,\n    Date: DateC1,\n    TicketNo: TicketE1,\n    EmployeeName: EmployeeB3,\n    PM: ProjectMB6,\n    SAProjectNo: SAPNE3,\n    WANo: WANE6\n  };\n}","description":"Pull Basic DFT Info Out","noCodeMetadata":null,"parameterInfo":"{\"version\":1,\"originalParameterOrder\":[],\"parameterSchema\":{\"type\":\"object\",\"default\":{},\"x-ms-visibility\":\"internal\"},\"returnSchema\":{\"type\":\"object\",\"properties\":{\"result\":{\"type\":\"object\",\"properties\":{\"Client\":{\"type\":\"string\"},\"Date\":{\"type\":\"string\"},\"TicketNo\":{\"type\":\"string\"},\"EmployeeName\":{\"type\":\"string\"},\"PM\":{\"type\":\"string\"},\"SAProjectNo\":{\"type\":\"string\"},\"WANo\":{\"type\":\"string\"}}}}},\"signature\":{\"comment\":\"\",\"parameters\":[{\"name\":\"workbook\",\"comment\":\"\"}]}}","apiInfo":"{\"variant\":\"synchronous\",\"variantVersion\":2}"}
    [-------------End script-----------]
     
     
     
  • RG-27121653-0 Profile Picture
    76 on at
    And thanks for ideas.  I am probably missing something simple.
     
    (Oh, connections all valid)
     
  • Suggested answer
    w.p Profile Picture
    8,339 Super User 2025 Season 2 on at
  • Suggested answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    Thank you for the additional information! 
     
    Indeed, I tested the flow with the ID property from the When a file is created (properties only) and got the same error. What worked for me was to use the Identifier property instead:
     
     
    Then the flow ran successfully:
     
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
     
  • RG-27121653-0 Profile Picture
    76 on at
    I too thought it may be the workbook reference.
     
    I did switch it over to "Identifier".   Still failed.
     
    I think I may have figured it out.   Bear with me.
     
    The error code from the changed run;
     
     
    That circled is NOT the name of the file I am working with.   Not sure why it is transposing the name of the file.
     
    The file ID resolves to the correct file.
     
    Am I running into caching issues ?
     
    Thanks for your help and suggestions.
     
    cheers!
  • Suggested answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
     
    The cache is a possible cause, especially because the flow was working fine in the past.
     
    Since I never got this issue before and it's hard to replicate from my end, I had a quick chat with Copilot and got these insights on how could you solve it:
    Force a Refresh – Try modifying the trigger conditions slightly (e.g., adding a filter or changing the query) to force Power Automate to re-register the trigger.
    Reconnect the SharePoint Connector – Sometimes, re-authenticating the SharePoint connection can clear cached triggers and refresh the flow.
     
     
    Another possible solution is to simply clone your flow and turn off the old version. I found this idea here: https://www.reddit.com/r/MicrosoftFlow/comments/15xaq2w/dealing_with_turned_off_flows_remembering/
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
     
     
     
     
     
     

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard