Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.