Pivot Table - Sheet Not picking up

Hello,
I trying to read a update an excel which has two sheets. Sheet one in a pivot table based on sheet two.

When a read the excel with the

new Workbook(“c\myPivot.xls”).getWorksheets();

the sheet with the pivot table does not show up the in collection of sheets.

I am using the aspose 8.5.1.

Please advice
Thanks
Vasanth

Hi,

Thanks for your posting and using Aspose.Cells.

Please provide us your source excel file (i.e myPivot.xls). Please check if there are any hidden worksheets inside your excel file. Also try to access your worksheet by name.

Please see the following code for your reference.

Java


Worksheet sheet = workbook.getWorksheets().get(“PivotSheetName”);

Hi Shakel,
Thank you for the quick response.When the sheet with the pivot table was the first sheet.this problem occurs…so I created a dummy sheet as the first sheet in the excel .it seems fine now.

Thanks
Vasanth

Hi,

Thanks for your feedback and using Aspose.Cells.

It seems you are not accessing the correct worksheet. You are accessing the worksheet which does not have any pivot table.

I have tested this issue with the following sample code and I am able to access the pivot table in the very first worksheet without any problem. I have tested it with the latest version: Aspose.Cells
for Java v8.5.1.6
.

Java


String filePath = “F:\Shak-Data-RW\Downloads\source.xls”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.getWorksheets().get(0);


PivotTable pivotTable = worksheet.getPivotTables().get(0);


System.out.println(pivotTable);

Console Output:
com.aspose.cells.PivotTable@1c99159