Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Sometimes, one pivot table uses another pivot table as a data source, so it is called a child pivot table or nested pivot table. You can find the child pivot tables of a parent pivot table using the PivotTable::GetChildren() method.
The following sample code loads the sample Excel file that contains three pivot tables. The bottom two pivot tables are children of the above pivot table, as shown in this screenshot. The code finds the child pivot tables using the PivotTable::GetChildren() method and then refreshes them one by one.

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Load sample Excel file
U16String inputFilePath = u"sampleFindAndRefreshNestedOrChildrenPivotTables.xlsx";
Workbook wb(inputFilePath);
// Access first worksheet
Worksheet ws = wb.GetWorksheets().Get(0);
// Access third pivot table
PivotTable ptParent = ws.GetPivotTables().Get(2);
// Access the children of the parent pivot table
Vector<PivotTable> ptChildren = ptParent.GetChildren();
// Refresh all the child pivot tables
int count = ptChildren.GetLength();
for (int idx = 0; idx < count; idx++)
{
// Access the child pivot table
PivotTable ptChild = ptChildren[idx];
// Refresh the child pivot table
ptChild.RefreshData();
ptChild.CalculateData();
}
std::cout << "Children pivot tables refreshed successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.