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
Yes, i have given the extension in the create file and also used the ID from the "Get File Metadata using path", in the Run Script. However, I am still getting the error - "The file format is not recognized. Please check that the selected workbook is valid."
Inside the "Create File", make sure you have the extension after what ever you call it.
Can you post some screen shots?
Hi,
I am using exactly the same steps mentioned by you using "Get File Metadata using path" and then passing the ID to the Run script, but i keep getting this error "The file format is not recognized. Please check that the selected workbook is valid.".
I have tried to open the file that was created using "Create File" just above the "Get File Metadata using path" and it is all fine. The format is correct and so is the extension. Can you please suggest what could be wrong here?
Thanks
Sujith
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!
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
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.
PLEASE MICROSOFT : Think things through
Yep, for some reason, it is rather particular about those IDs.
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.
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.