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

Free Support Forum - aspose.com

Pivot Table Data Source - Name of Table

I have a Pivot Table that has a data source that is a table. When I call pivotTable.getSource() it just gives me the name of that table - but I want to access the cells in that table. Is there any way to get more information about the source (what type of excel content it is, what tab it is on?) or the range of that source? I am trying to parse excel files dynamically, so I wont know what source is driving the table - I need to adjust dynamically based on the source. `M&A Pipeline - Purple (1).zip (83.1 KB)

I attached the file above – the pivot table is on the stock price worksheet.

image.png (7.2 KB)

you can see in the attachment the source returned is “SharePrice” which doesn’t give me much to work with…

@mallain2323,

PivotTable.GetSource() will give you the data source range/table name, so, you have to use your own code to traverse through the range of cells or table (range) cells by yourselves. You may evaluate if it is a table in code by yourselves. For example, you may create an array or list with named ranges and table names via WorksheetCollection.GetNamedRangesAndTables() that returns an Range[]. Alternatively, you may traverse though ListObjectCollection in the particular worksheet(s) and then check if name (obtained by PivotTable.GetSource()) exists or matches with it (via ListObject.DisplayName). Also, you may gather ranges of table via ListObject.DataRange and then loop the ranges of the source cells for your requirements. I am afraid, there is no relevant APIs or options in Aspose.Cells to get everything in one go, so you have to write code for it by yourselves.