Can Office Scripts Remove Excel Workbook Data Connections Online?
Question details
The user wants to create a non-refreshing SharePoint copy of an Excel workbook while removing its Power BI and Fabric Lakehouse data connections online.

- Product
- Excel for the web, Office Scripts, SharePoint, and Power Automate
- Device & OS
- not provided
- Scenario
- A SharePoint workbook contains PivotTables connected to Power BI and a Fabric Lakehouse, and the user needs an online-only copy that does not retain refreshable connections.
- Observed behavior
- Office Scripts does not provide a supported workbook API for deleting existing data connections.
Identify whether the workbook contains only PivotTable connections or also Power Query queries, Power Pivot data models, or external links. Copying the file in SharePoint or Power Automate preserves these embedded workbook connections.
Use Desktop Excel to Remove Workbook Connections Before Sharing a Copy
Use this practical method when the workbook must be delivered without refreshable Power BI, Fabric, query, or external data connections.
Excel for the web and Office Scripts do not currently provide a supported way to delete workbook data connections. Desktop Excel provides the relevant connection and query management tools.
In the SharePoint document library, select the workbook, choose Open, and then select Open in Desktop App.
In desktop Excel, go to the Data tab and select Queries & Connections. Open the Connections tab or choose Data > Queries & Connections to identify connections used by the workbook.
Select the unwanted connection or query and choose Remove or Delete. If a PivotTable depends on it, remove or replace that PivotTable first as needed.
Choose File > Save As, create a new workbook copy, and save it back to the SharePoint library after confirming that it no longer refreshes from the external source.

Use Power Automate Only to Copy the Workbook
Use this when you only need to create a duplicate file online and can accept that its existing data connections will remain.
Modify the XLSX Package with Custom Code
Use this advanced option only when desktop Excel is unavailable and your organization can safely maintain custom XLSX package processing.
Use WPS Office for Everyday Excel-Compatible Workbook Editing
Office Scripts cannot remove Excel workbook data connections online. For everyday spreadsheet creation and editing, WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and straightforward migration from Microsoft Office files.

Frequently Asked Questions
Can Office Scripts delete data connections from an Excel workbook?
No. Office Scripts does not currently expose a supported method in the ExcelScript.Workbook API to delete existing workbook data connections.
Will Power Automate remove Power BI connections when it copies an Excel file?
No. The SharePoint Copy file action creates a duplicate of the XLSX file and retains its embedded Power BI, Fabric, query, and other workbook connections.
Can I remove a Fabric Lakehouse connection in Excel for the web?
Excel for the web does not provide a supported online workflow for removing existing workbook data connections. Open the file in desktop Excel to manage queries and connections.
What happens to PivotTables after I remove their data connection?
PivotTables that rely on the removed connection may no longer refresh and can become invalid. Preserve the displayed results as values or rebuild the PivotTable from a local data range if needed.
Is editing the XLSX XML files a safe way to remove connections?
It can be possible with specialized custom code, but it is complex because connection references can exist in multiple XML parts and relationships. Test every generated workbook carefully to avoid corruption.




