We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to read a values from the pivot table using aspose java?

I could create a pivot table but i couldn’t get the values from that pivot table. Actually i need to copy the values from the pivot table and paste it on some others sheet . Is it possible or not?


You can access a PivotTable from a WorkSheet then all fields and methods of PivotTable class can be accessed.

// Instantiating an Workbook object
Workbook workbook = new Workbook("PivotTable.xlsx");
// Obtaining the reference of the worksheet
Worksheet sheet = workbook.getWorksheets().get("PivotTable");
// Getting the pivottables collection in the sheet
PivotTableCollection pivotTables = sheet.getPivotTables();
// Accessing the instance of PivotTable
PivotTable pivotTable = pivotTables.get(1);

Hope this helps a bit.


Moreover, if you need cells values in the Pivot table report, well, you need to refresh and calculate PivotTable data in the worksheet before creating and copying range of values b/w the worksheets. See the lines of code for your reference:
Sample code:

           // Your code goes here.