Data Import & Export

Can Office Scripts Remove Excel Workbook Data Connections Online?

John WilsonJohn Wilson Nov 12, 2026 868 views

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.

Can Office Scripts Remove Excel Workbook 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the workbook in the desktop app

In the SharePoint document library, select the workbook, choose Open, and then select Open in Desktop App.

2
Review workbook connections

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.

3
Remove the connection or query

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.

4
Save a separate static copy

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 Desktop Excel to Remove Workbook Connections Before Sharing a Copy
Connection-dependent objects may need changes: Deleting a connection can affect PivotTables, queries, charts, and formulas that depend on imported data. Keep values in a separate static range if users need to view the existing results.
Free Microsoft Office alternative

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.

Free and lightweight spreadsheet editing for everyday workbook tasksFamiliar ribbon-style interface helps users move from Microsoft Excel quicklySupports Microsoft Excel .xlsx and .xls workbook formatsLets you open, review, and edit workbook data and PivotTable layouts locallyMaintains compatibility when sharing standard Excel files with Microsoft Office users
microsoft office alternative - wps office

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.