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
{
"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
Solved! Go to Solution.
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.
I have run this one several times on different files and so far it works.
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.
Was wondering if anyone else had any thougth?
also looking for a solution to this.
This is the script. Pretty basic.
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.
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)
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.
I have run this one several times on different files and so far it works.
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.
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.
When you start messing with tables in your excel files, it can also be a pain.
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.
You have to type in the table name and make sure the down arrow turns into an "X".
Now when the file ID changes, the scripts will still run and the table and key column will still run also.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
27 | |
26 | |
26 | |
23 | |
23 |
User | Count |
---|---|
62 | |
44 | |
41 | |
29 | |
27 |