Pivot Table Issues

Refresh Excel PivotTables with Office Scripts and Power Automate

Nimra MalikNimra Malik Dec 2, 2026 869 views

Question details

The user needs to refresh Excel data connections and their related PivotTables using an Office Script in Power Automate.

Refresh Excel PivotTables with Office Scripts and Power Automate
Product
Microsoft Excel, Office Scripts, and Power Automate
Device & OS
not provided
Scenario
A Power Automate flow runs an Office Script against a workbook with data connections and PivotTables.
Observed behavior
The script runs without an error, but the related PivotTables do not update.
Before you start

Open the workbook in Excel and identify the PivotTables and their source data connections. Check Microsoft's current Office Scripts data refresh limitations for Power Automate, since support can vary by refresh method and data source.

Solution 1Recommended

Correct the PivotTable refresh call in the Office Script

Use parentheses to invoke the refresh method, then test the script in a supported Excel environment.

Calling the method correctly is necessary, but it does not override Power Automate's Office Scripts refresh limitations. Microsoft documents that PivotTable refresh methods do nothing when called through Power Automate.

1
Open the script

In Excel for the web, open the workbook, select Automate, and open the script in the Code Editor.

2
Invoke the refresh method

In the main function, add the method call with parentheses: workbook.refreshAllPivotTables();

3
Test the result

Save and run the script from Excel, then check the PivotTable values against the source data. If the script is run through Power Automate, do not assume a successful flow means the PivotTables refreshed.

Correct the PivotTable refresh call in the Office Script
Check refresh support: Power Query and data connection refresh support differs by execution environment and source. Review Microsoft's current documentation before relying on a flow to refresh them.
Free Microsoft Office alternative

Work with spreadsheets and PivotTables in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Excel format compatibility for an easier transition. It does not fix Microsoft's Office Scripts or Power Automate refresh limitations.

Work with PivotTables in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceMove existing spreadsheets into a lightweight Office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PivotTable stay unchanged when the Power Automate flow succeeds?

A successful script run does not guarantee a refresh. Microsoft documents that Office Scripts PivotTable refresh methods do nothing when called through Power Automate. Check the current limitations and refresh the workbook in a supported environment.

How do I call refreshAllPivotTables correctly?

In the Office Scripts Code Editor, use workbook.refreshAllPivotTables(); inside the main function. Without parentheses, the method is referenced rather than invoked.

Can an Office Script refresh a Power Query in Power Automate?

Do not assume it can. Office Scripts data refresh support in Power Automate is limited and depends on the method and source. Check Microsoft's current documentation for your specific connection.

How can I refresh a PivotTable manually?

In desktop Excel, refresh the source from Data > Refresh All. Once the source finishes updating, right-click the PivotTable and select Refresh if needed.