Fixed: "Script not found. It may have been unshared or deleted." in Power Automate
Run script from SharePoint library said Script not found. It may have been unshared or deleted. about a script that was right there in the library. The action still held the ID of the copy on the old site. Picking the script again with the folder icon fixed it, and the script's parameters came back with their values.
What I Was Doing
I was installing the Overtime Timesheet app in a new environment, with a new SharePoint site (Part 21). One of its flows, Create Payroll Workbook, fills a payroll workbook with an Office Script kept in the site's Payroll Exports library. It uses the Excel Online (Business) action Run script from SharePoint library (How to Run an Office Script from a SharePoint Library in Power Automate), here called Fill the workbook, which was set up on the development site.
On the new site, I uploaded the same two files, the template and Fill Payroll Workbook.osts, to a Setup folder in its Payroll Exports library. The flow came in a managed solution, so I edited it from an unmanaged one (How to Edit a Cloud Flow in a Managed Solution in Power Automate).
In Fill the workbook, Workbook Location and Script Location already read the new site from an environment variable. Workbook Library and Script Library showed long IDs starting with b! instead of names: the development site's library. I cleared both with their X and picked Payroll Exports from each drop-down, which now listed the new site's libraries. As soon as Script Library changed, the script's two parameters, monthTitle and entries, disappeared from the card.
Then I selected the folder icon in the Script box, which still read /Setup/Fill Payroll Workbook.osts.
What I Expected
The file picker, showing the new library's folders. The path in the box was the path of the file I had just uploaded.
What I Got
A red error at the top of the card, and no picker:

The full text:
The dynamic operation request to API 'excelonlinebusiness' operation 'GetSingleScriptV2' failed with status code 'NotFound'. This may indicate invalid input parameters. Error response: { "status": 404, "message": "Script not found. It may have been unshared or deleted. clientRequestId: 00000000-0000-0000-0000-000000000000", "error": { "message": "Script not found. It may have been unshared or deleted." }, "source": "excelonline-uks.azconn-uks-002.p.azurewebsites.net" }
What I Checked
- The file. Fill Payroll Workbook.osts was in the Setup folder of the new site's Payroll Exports library. I had uploaded it minutes earlier, and as the site's owner I could open it. So it wasn't deleted, and it wasn't unshared from me.
- What the action keeps. Microsoft's connector reference lists the action's script parameters as
scriptDrive, "the SharePoint library of your Office Script file (.osts)", andscriptId, "an Office Script file (.osts) in a SharePoint library", both chosen in the designer. When I exported this flow for release, its definition held IDs for both, not names (Part 20):"scriptDrive": "b!…"and"scriptId": "01…". The path in the Script box is only how the designer shows that ID. - What failed. The error names the call:
GetSingleScriptV2, a dynamic operation request. That's the designer asking the connector about the chosen script, and the parameters vanished at the same moment because it got404back instead of the script. - Microsoft's documentation. Troubleshoot Office Scripts running in Power Automate doesn't list this message. It does say to choose workbooks with the file browser instead of typing their names, and that "the signature of a script is stored with the Excel Business (Online) connector when it is created."
Why It Happens
A library on another site is a different library, and a script uploaded there is a different file, each with its own ID. Picking Payroll Exports changed the library ID, but Script still held the ID of the development site's file. The designer asked for that file in the new library, the connector found no such file, and the message offers the two reasons it can think of: unshared or deleted. Without the script, the designer can't show its parameters, so monthTitle and entries went too.
A solution import can't fix this for you. The import asks for environment variable values and connections. The library and the script are plain values inside the action, so they arrive with the old site's IDs.
The Fix
Pick the script again from the new library:
- Select the folder icon in Script again. This time the file picker opened, at the top of the library.
- Select > next to Setup to open the folder.
- Select Fill Payroll Workbook.osts.
After the Fix
The error went away, and monthTitle and entries came back with the values they had before: the formatDateTime(...) expression and Output from the Payroll rows step:

I saved the flow and turned it back on. The first run in the new environment created November's payroll workbook in the new site's Payroll Exports library, filled in by the script.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Trusting the path shown in Script | It's the old file's path, so it looks right, but the action uses the old file's ID | Pick the script again with the folder icon |
| Changing only the libraries | The library IDs are new, and the script ID is still the old one | After Script Library, pick Script too |
| Adding the parameters again by hand first | Their boxes aren't there until the designer can read the script | Pick the script first; the values came back by themselves |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Script not found after moving a flow to another site or environment | Script holds the old file's ID | Pick the script again in the new library |
| The library drop-down doesn't list the new site's libraries | Script Location doesn't point at the new site | Check the location; here it's an environment variable's value |
| The picker doesn't show the .osts file | It isn't in that library, or the folder has more than 200 items | Upload it there; the connector's picker shows up to 200 items per folder |
| The parameters don't come back after picking the script | The script's parameters changed since the action was added | The troubleshooting article's advice: remove the action and add it again |
FAQ
Was the script really unshared or deleted?
No. The file was in the library, and I could open it. The message lists the usual reasons a script can't be found, and here the real one was an ID from another library.
Do I have to enter the script's parameters again?
Not in my case. Once the script was picked, monthTitle and entries came back with the expression and the dynamic content they had before.
Which other values in a flow behave like this?
Anything chosen from a drop-down or a file picker that isn't an environment variable, such as a workbook's library and file in other Excel Online (Business) actions. When a flow moves to another site, pick each of them again.
Conclusion
Script not found. It may have been unshared or deleted. came from an ID, not a missing file: Run script from SharePoint library keeps the IDs of the library and the script it was set up with. After moving the flow to a new site, pick the library and then the script again, and the parameters come back.
Additional Resources
- Excel Online (Business) connector: the Run script from SharePoint library parameters.
- Run Office Scripts with Power Automate: the two Run script actions.
- Troubleshoot Office Scripts running in Power Automate: parameters that don't appear, and the file browser.
