The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

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.

Note

If your PivotTable report contains cell formatting, it may 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.
pivotTable.Cache.Refresh();

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