Skip to main content

How to: Refresh a Pivot Table

To refresh a pivot table and retrieve the latest data from a data source, use the PivotCache.Refresh method of the PivotTable cache accessible through the PivotTable.Cache property. All pivot tables that are based on the same PivotCache will also be refreshed.


If your PivotTable report contains cell formatting, it will disappear after the refresh operation.

If you wish to prevent column widths from being automatically adjusted when the PivotTable data is refreshed, set the PivotBehaviorOptions.AutoFitColumns property to false.

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Refresh the pivot table.

To refresh all pivot tables in a workbook at once, use the PivotCacheCollection.RefreshAll method.