Refresh an Excel PivotTable When the Source Workbook Is Open
Question details
Refresh an Excel PivotTable that uses an external workbook as its source while the source data is being edited.

- Product
- Microsoft Excel Power Query and PivotTable
- Device & OS
- not provided
- Scenario
- A PivotTable or Power Query connection reads data from a separate Excel workbook that needs to remain open for editing.
- Observed behavior
- Refreshing the connection can produce a file-in-use or DataSource.Error message while the source workbook is open.
Check whether the PivotTable reads from an external workbook through Power Query and identify the source file. Confirm whether the PivotTable must remain in a separate workbook or can be created alongside the source data.
Create the PivotTable in the Source Workbook and Use Two Windows
Use this workaround when you need to display a PivotTable while editing its source data.
A PivotTable based directly on a table in the same workbook avoids the external-file read that may cause the error. The two windows show the same workbook, so changes in either window affect the same file.
Open the source workbook, select the data, and choose Insert > Table. Confirm the range and whether it has headers.
Select a cell in the table, choose Insert > PivotTable, and create the PivotTable in the same workbook. Add the fields you need to the PivotTable.
Choose View > New Window. In one window, display the source table; in the other, display the PivotTable.
Edit the source table in one window, then switch to the PivotTable window, right-click the PivotTable, and select Refresh.

Close the External Source Workbook Before Refreshing
Use this approach when the PivotTable must remain in a separate workbook.
Work with Spreadsheet Data and PivotTables in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility for easier migration. It does not resolve Excel Power Query file-lock errors, and existing queries should be tested before migrating.

Frequently Asked Questions
Why does Power Query show a file-in-use error when I refresh?
Power Query may be unable to read an external workbook while it is open for editing by another process. Save and close the source workbook, then use Data > Refresh All in the destination workbook.
Can I edit the source data and show the PivotTable at the same time?
Yes. Create a PivotTable directly from a table in the source workbook, then choose View > New Window. Show the data in one window and the PivotTable in the other, and refresh the PivotTable after editing.
Will a PivotTable update automatically when I change its source data?
Not necessarily. After editing the source table, right-click the PivotTable and select Refresh, or use Data > Refresh All.
Does closing the source workbook preserve my latest edits for refresh?
Save the source workbook with File > Save before closing it. The external connection can then read the saved version when you refresh the destination workbook.




