How to Fix Intermittent Office Script Workbook Not Found Errors in Excel
Question details
The user needs to resolve an intermittent 'Workbook not found' error that occurs when a Power Automate flow attempts to run an Office Script on a newly converted Excel file.

- Product
- Microsoft Excel / Power Automate
- Device & OS
- not provided
- Scenario
- Automating the conversion of a CSV file to Excel and immediately executing an Office Script via Power Automate.
- Observed behavior
- The flow randomly fails with a 'Workbook not found' error, but succeeds when the file is manually selected again, pointing to a potential timing or file identifier synchronization issue.
Review your Power Automate flow run history to confirm whether the 'Create file' step successfully finishes before the 'Run script' step begins to rule out immediate synchronization delays.
Add a Delay Action in Power Automate
Introduce a wait time between file creation and script execution to ensure the file is fully indexed and available.
When a flow creates a new Excel file and immediately tries to run an Office Script on it, cloud storage platforms like OneDrive or SharePoint may not have finished indexing the file. Adding a deliberate pause gives the system enough time to recognize the new file.
Open your flow in the Power Automate editor and locate the step where the CSV is converted to an Excel file.
Click the '+' icon between the 'Create file' action and the 'Run script' action. Search for and select the 'Delay' action.
Set the 'Count' to 30 or 60, and the 'Unit' to 'Second'. This provides an adequate buffer for the file creation to finalize.
Save the flow and run a manual test to verify that the 'Workbook not found' error no longer occurs.

Verify Dynamic File Identifiers
Ensure the 'Run script' step correctly maps to the dynamic ID of the newly created file rather than a static or cached path.
Consult Microsoft OfficeDev Repositories
Seek specialized troubleshooting for persistent JavaScript or Office Script API bugs.
Switch to WPS Office for a Reliable Spreadsheet Experience
If you frequently encounter synchronization, timing, or script errors in cloud-heavy ecosystems, consider WPS Office. It is a free, lightweight, and robust alternative that allows you to manage data and edit spreadsheets smoothly without complex cloud-flow dependencies.
- 1. Download and Install: Visit the official WPS website to securely download and install the free WPS Office suite on your computer.
- 2. Open Your Spreadsheets: Launch WPS Spreadsheets and open your existing .xlsx or .csv files seamlessly without worrying about formatting loss.
- 3. Edit with Ease: Enjoy robust formula support, intuitive chart tools, and reliable local editing without complex automation flow errors.

Frequently Asked Questions
Why does my Power Automate flow intermittently say 'Workbook not found'?
This is almost always a timing issue. The flow attempts to execute the Office Script before SharePoint or OneDrive has fully processed, indexed, and unlocked the newly converted Excel file.
How long should the delay be before running the Office Script?
A delay of 30 to 60 seconds is generally sufficient to ensure the newly created file is properly registered by the server and available for the script to access.
Where can I get advanced support for JavaScript and Office Scripts?
The Microsoft OfficeDev repositories on GitHub are the recommended community resource for troubleshooting specific JavaScript API behaviors, Office Script limitations, and reporting persistent bugs.




