How to Resolve Office Scripts Sharing and Permission Issues in Excel
Question details
Users are experiencing errors where an Office Script runs initially in a shared workbook but later reports that the script has been unshared or is inaccessible.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Collaborating on shared Excel workbooks and attempting to run or distribute Office Scripts among team members.
- Observed behavior
- The Office Script executes successfully once for shared users but subsequently throws an error stating it has been unshared, preventing further execution.
Ensure that your shared workbook is saved in SharePoint or OneDrive, as Office Scripts require cloud storage to function collaboratively. Verify that all users have an eligible Microsoft 365 license with Office Scripts enabled.
Embed the Script in the Workbook Using a Button
Adding the script to the workbook via a button ensures that anyone with access to the workbook can run the script without encountering individual file sharing errors.
By default, Office Scripts are stored separately in the creator's personal OneDrive rather than embedded in the workbook like traditional VBA macros. Adding a button creates a direct link within the file, automatically granting run permissions to anyone who can edit the workbook.
Open the shared workbook in Excel (web or desktop) and navigate to the 'Automate' tab on the main ribbon.
Click on 'Code Editor' to view the list of your available scripts.
Click on the specific script you want to share with your collaborators.
Click on 'More options' (the three dots icon) in the script pane and select 'Add button'. A clickable button will appear on the grid, allowing any user with edit access to run the script.

Share the Script Individually from the Code Editor
If you prefer not to add a button to your worksheet grid, you can explicitly share the script link with specific users from your Office Scripts library.
Use WPS Office for Reliable Macro and Automation Support
If you are struggling with complex cloud-sharing permissions and script ownership issues in Excel, consider WPS Office. WPS Office provides robust support for traditional VBA macros and its own JavaScript macros, offering a seamless and lightweight alternative for automating spreadsheet tasks without complex OneDrive permission hurdles.
- 1. Download WPS Office: Visit the official WPS Office website and download the free desktop application.
- 2. Open your spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbooks seamlessly.
- 3. Use Macro tools: Navigate to the 'Tools' tab to access Macro features and automate your workflows without cloud-sharing conflicts.

Frequently Asked Questions
Why does my Office Script say it has been unshared?
This usually happens because Office Scripts are stored in the original creator's personal OneDrive by default, not inside the workbook. If the owner's sharing link expires, or if they move or delete the file in their OneDrive, the script becomes inaccessible to collaborators.
How do Office Scripts differ from VBA macros in terms of sharing?
VBA macros are embedded directly inside the workbook file (e.g., .xlsm). When you share the file, the macros go with it. Office Scripts are saved as separate files in your cloud storage and must be explicitly shared or attached to a workbook via a button to be used collaboratively.
Can I run Office Scripts offline in Excel?
No. Office Scripts require an active internet connection and must be saved in OneDrive for Business or SharePoint to run or be shared with other users.




