cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chipper
Helper II
Helper II

Running a script is hit and miss.

I have a flow that starts when I new file is created.  Turns the CSV into an excel file, saves it to a one drive folder and then runs a script to clean up the file.  All of it works, up to the part of running the script.  If I open the file in Excel Online and run the script, all is good.  But when the flow tries to run it, I get this error.

 

We were unable to run the script. Please try again.
Workbook not found.
clientRequestId: f6513d18-324b-4f26-9544-d17c6a53d539

 

This is the raw output.

{
    "statusCode": 404,
    "headers": {
        "Access-Control-Expose-Headers": "Version",
        "x-ms-workflow-name": "****************************",
        "Version": "2.5",
        "x-ms-client-request-id": "****************************",
        "x-ms-request-id": "****************************",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "Cache-Control": "no-store, no-cache",
        "Date": "Fri, 21 May 2021 14:23:44 GMT",
        "Content-Length": "165",
        "Content-Type": "application/json"
    },
    "body": {
        "message": "We were unable to run the script. Please try again.\nWorkbook not found.\r\nclientRequestId: f6513d18-324b-4f26-9544-d17c6a53d539",
        "logs": []
    }
}

 

Now, if I go back in and redrill back to the file again, all runs well

 

Screen Shot 2021-05-21 at 10.32.24 AM.png

 

{
    "statusCode": 200,
    "headers": {
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "Access-Control-Expose-Headers": "Version",
        "x-ms-workflow-name": "*****************************",
        "Version": "2.5",
        "x-ms-client-request-id": "*****************************",
        "x-ms-request-id": "*****************************",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Cache-Control": "no-store, no-cache",
        "Set-Cookie": "ARRAffinity=fbf12317b41409d837dc9258ca2fd506a0e78d7705046af5c2a888ad2128246d;Path=/;HttpOnly;Secure;Domain=excelonline-eus.azconn-eus.p.azurewebsites.net,ARRAffinitySameSite=fbf12317b41409d837dc9258ca2fd506a0e78d7705046af5c2a888ad2128246d;Path=/;HttpOnly;SameSite=None;Secure;Domain=excelonline-eus.azconn-eus.p.azurewebsites.net",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "false",
        "Date": "Fri, 21 May 2021 14:31:46 GMT",
        "Content-Type": "application/json; charset=utf-8",
        "Content-Length": "25"
    },
    "body": {
        "logs": []
    }

 

So I think it has something to do with the "File" portion of the excel part of the flow.  It is using the file ID instead of just the file name?

Any thoughts on how to get around this?

 

Thanks

Chip

1 ACCEPTED SOLUTION

Accepted Solutions
Chipper
Helper II
Helper II

I think I have figured this one out.  The Excel step for running a script does appear to use the file ID instead of the file name.  After running into some other issues with other triggers, I learned how to use "Get file metadata using path".  This one is different than using "Get File Metadata".  The second one uses the file ID to get the info, the first one uses the path to get the info and disregards the file ID.

 

This is the steps that I used.

 

Screen Shot 2021-08-06 at 8.27.36 AM.png

 

I have run this one several times on different files and so far it works.

View solution in original post

13 REPLIES 13
automate1t
Regular Visitor

I am also running up against this issue. I have an Excel spreadsheet which comes in daily which I save to OneDrive using Power Automate. I have an Office Script which then re-formats the file and I then need to distribute that file to a number of people. The issue is that when you use Power Automate to run the script even though you choose the file the script is actually looking for a specific file ID rather than the a file with a particular name. The result is that when the new file is saved in OneDrive it gets a new ID and the script then fails. For me it seems a really big problem because you either have to manually intervene to copy the data into the existing file or run the Office Script manually. In either case the automation bit goes out the window. I cannot see any good ways to achieve the automation I desire as the options for Excel in Power Automate are quite limited.

Chipper
Helper II
Helper II

Was wondering if anyone else had any thougth?

AlaskanPowrUser
Frequent Visitor

also looking for a solution to this. 

AlaskanPowrUser
Frequent Visitor

Screen Shot 2021-07-11 at 3.42.39 PM.png

 

This is the script. Pretty basic. 

Chipper
Helper II
Helper II

I have a feeling that what we are going to have to do is create a blank worksheet. Then use power automate to populate that worksheet. Then run our script. 

Then, on the next day, clear that worksheet, and run the script again. 

AlaskanPowrUser
Frequent Visitor

I have a slight variation, But i'm running across the same error executing a script. 

I receive an .xlsx via email, and I am unable to change the fact that the data within is not in a formatted table. So I'm in a rough spot, because (to my understanding) I am unable to read excel data unless it's in a table. 

The goal here, was to use power automate to trigger on receiving an email, pull the attachment, create file using content bytes, then run a script that simply turns a consistent set of columns into a table 200 rows down always (30 should be fine, buffer) and THEN I can get rows from that newly created excel table, and start backing up the data to a sharepoint list (eventually an sql table, but sharepoint for demo purposes) 

Chipper
Helper II
Helper II

I think I have figured this one out.  The Excel step for running a script does appear to use the file ID instead of the file name.  After running into some other issues with other triggers, I learned how to use "Get file metadata using path".  This one is different than using "Get File Metadata".  The second one uses the file ID to get the info, the first one uses the path to get the info and disregards the file ID.

 

This is the steps that I used.

 

Screen Shot 2021-08-06 at 8.27.36 AM.png

 

I have run this one several times on different files and so far it works.

berandomsen
Frequent Visitor

I have experienced something similar, but I think its a bug in Power Automate, I can replicate it too. 

 

I had one Run Script that just did not work, when all the other Run Script actions worked fine doing the same exact thing.  Nothing I did worked, and it wasn't logical. 

 

My solution was to delete the Run Script, add the action back in re-enter the fields, it worked after that.  The problem seems to be changing the Document it points to after the action has already been created, it will no longer read Excel Files after this.  The current solution proposed would work because they're creating a new action, and are discarding the defunct one. 

Chipper
Helper II
Helper II

I think I am following you.  And I think I figured out the same thing as you did.  You have to use the file ID for the file section.  Otherwise if the file changes, it won't take it.  Even if the file name doesn't change, the file ID still does.

 

Screen Shot 2022-02-10 at 11.06.12 AM.png

 

When you start messing with tables in your excel files, it can also be a pain.

 

Screen Shot 2022-02-10 at 11.16.45 AM.png

Screen Shot 2022-02-10 at 11.17.43 AM.png

 But once the file changes, it doesn't work because the file ID changes. So, you add the function of ID in the field, the Table and Key Columns don't show up.

 

Screen Shot 2022-02-10 at 11.22.26 AM.png

Screen Shot 2022-02-10 at 11.22.52 AM.png

 You have to type in the table name and make sure the down arrow turns into an "X".

 

Screen Shot 2022-02-10 at 11.26.30 AM.png

 

Now when the file ID changes, the scripts will still run and the table and key column will still run also.

I had the problem and found your post. I swapped the path to the workbook with File ID. It worked beautifully!

You saved my day!! Many thanks.

Yep, for some reason, it is rather particular about those IDs.

pg2020
Helper I
Helper I

Dear Chipper : YOU ARE MY HERO!! 🙂

I've been working on this error for days.

I am currently trying to implement the following links: (Official instructions from Microsoft ! )

https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/convert-csv

https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/combine-worksheets-into-singl...

 

The second link describes exactly how to specify a output file in the the Excel script 2.

In the first run, the script and the flow works.
Not in the next round.

My findings and please Microsoft READ THIS! :

First, there is a major limitation of the Excel Connector:

https://learn.microsoft.com/en-us/connectors/excelonlinebusiness/

An Excel file may be locked for an update or delete up to 6 minutes since the last use of the connector.

 

 


And instead of as described in Microsofts instructions to select a Destination file, I did the following:

I start a copy process that copies an empty Excel file to the destination at the beginning of the flow.
And later in the Excel script I take the ID of the Copy file instead of the file name. 
So the Excel script 2 always takes the new destination xlsx file that was previously copied.

I also have to consider the 6-minute suspension. The target file is then blocked for 6 minutes. If you want to move it or overwrite it, you have to wait 6 minutes or more.

 

03.jpg

 

PLEASE MICROSOFT : Think things through

zak325
New Member

Thanks so much for this! Was having a similar issue where the Excel was being emptied then populated but at times the scripts couldn't run because I'm guessing the above file Id issue. I just added a step like you showed above and re-run it with no issues!

Helpful resources

Announcements

Power Platform Connections Ep 15 | L. Baybutt | Thursday, 1 June 2023

Episode Fifteen of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Lewis Baybutt aka Low Code Lewis, alongside the latest news and community blogs.   Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.        Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.  Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions. 

May 2023 Community Newsletter and Upcoming Events

Welcome to our May 2023 Community Newsletter, where we'll be highlighting the latest news, releases, upcoming events, and the great work of our members inside the Biz Apps communities. If you're new to this LinkedIn group, be sure to subscribe here in the News & Announcements to stay up to date with the latest news from our ever-growing membership network who "changed the way they thought about code".         LATEST NEWS "Mondays at Microsoft" LIVE on LinkedIn - 8am PST - Monday 15th May  - Grab your Monday morning coffee and come join Principal Program Managers Heather Cook and Karuana Gatimu for the premiere episode of "Mondays at Microsoft"! This show will kick off the launch of the new Microsoft Community LinkedIn channel and cover a whole host of hot topics from across the #PowerPlatform, #ModernWork, #Dynamics365, #AI, and everything in-between. Just click the image below to register and come join the team LIVE on Monday 15th May 2023 at 8am PST. Hope to see you there!     Executive Keynote | Microsoft Customer Success Day CVP for Business Applications & Platform, Charles Lamanna, shares the latest #BusinessApplications product enhancements and updates to help customers achieve their business outcomes.         S01E13 Power Platform Connections - 12pm PST - Thursday 11th May Episode Thirteen of Power Platform Connections sees Hugo Bernier take a deep dive into the mind of co-host David Warner II, alongside the reviewing the great work of Dennis Goedegebuure, Keith Atherton, Michael Megel, Cat Schneider, and more. Click below to subscribe and get notified, with David and Hugo LIVE in the YouTube chat from 12pm PST. And use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.         UPCOMING EVENTS   European Power Platform Conference - early bird ticket sale ends! The European Power Platform Conference early bird ticket sale ends on Friday 12th May 2023! #EPPC23 brings together the Microsoft Power Platform Communities for three days of unrivaled days in-person learning, connections and inspiration, featuring three inspirational keynotes, six expert full-day tutorials, and over eighty-five specialist sessions, with guest speakers including April Dunnam, Dona Sarkar, Ilya Fainberg, Janet Robb, Daniel Laskewitz, Rui Santos, Jens Christian Schrøder, Marco Rocca, and many more. Deep dive into the latest product advancements as you hear from some of the brightest minds in the #PowerApps space. Click here to book your ticket today and save!      DynamicMinds Conference - Slovenia - 22-24th May 2023 It's not long now until the DynamicsMinds Conference, which takes place in Slovenia on 22nd - 24th May, 2023 - where brilliant minds meet, mingle & share! This great Power Platform and Dynamics 365 Conference features a whole host of amazing speakers, including the likes of Georg Glantschnig, Dona Sarkar, Tommy Skaue, Monique Hayward, Aleksandar Totovic, Rachel Profitt, Aurélien CLERE, Ana Inés Urrutia de Souza, Luca Pellegrini, Bostjan Golob, Shannon Mullins, Elena Baeva, Ivan Ficko, Guro Faller, Vivian Voss, Andrew Bibby, Tricia Sinclair, Roger Gilchrist, Sara Lagerquist, Steve Mordue, and many more. Click here: DynamicsMinds Conference for more info on what is sure an amazing community conference covering all aspects of Power Platform and beyond.    Days of Knowledge Conference in Denmark - 1-2nd June 2023 Check out 'Days of Knowledge', a Directions 4 Partners conference on 1st-2nd June in Odense, Denmark, which focuses on educating employees, sharing knowledge and upgrading Business Central professionals. This fantastic two-day conference offers a combination of training sessions and workshops - all with Business Central and related products as the main topic. There's a great list of industry experts sharing their knowledge, including Iona V., Bert Verbeek, Liza Juhlin, Douglas Romão, Carolina Edvinsson, Kim Dalsgaard Christensen, Inga Sartauskaite, Peik Bech-Andersen, Shannon Mullins, James Crowter, Mona Borksted Nielsen, Renato Fajdiga, Vivian Voss, Sven Noomen, Paulien Buskens, Andri Már Helgason, Kayleen Hannigan, Freddy Kristiansen, Signe Agerbo, Luc van Vugt, and many more. If you want to meet industry experts, gain an advantage in the SMB-market, and acquire new knowledge about Microsoft Dynamics Business Central, click here Days of Knowledge Conference in Denmark to buy your ticket today!   COMMUNITY HIGHLIGHTS Check out our top Super and Community Users reaching new levels! These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities.   Power Apps:  Super Users: @WarrenBelz, @LaurensM  @BCBuizer  Community Users:  @Amik@ @mmollet, @Cr1t    Power Automate:  Super Users: @Expiscornovus , @grantjenkins, @abm  Community Users: @Nived_Nambiar, @ManishSolanki    Power Virtual Agents:  Super Users: @Pstork1, @Expiscornovus  Community Users: @JoseA, @fernandosilva, @angerfire1213    Power Pages: Super Users: @ragavanrajan  Community Users: @Fubar, @Madhankumar_L,@gospa  LATEST COMMUNITY BLOG ARTICLES  Power Apps Community Blog  Power Automate Community Blog  Power Virtual Agents Community Blog  Power Pages Community Blog  Check out 'Using the Community' for more helpful tips and information:  Power Apps , Power Automate, Power Virtual Agents, Power Pages 

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren  David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite   metsshan    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (4,622)