Insert Pivot Table
Contents
[
Hide
]
Create Pivot Table
It is possible to use Aspose.Cells for Python via .NET to add pivot tables to spreadsheets programmatically.
Pivot Table Object Model
Aspose.Cells for Python via .NET provides a special set of classes in the aspose.cells.pivot namespace that are used to create and control pivot tables. These classes are used to create and set PivotTable objects, the building blocks of a pivot table. The objects are:
- PivotField represents a field in a PivotTable.
- PivotFieldCollection represents a collection of all the PivotField objects in the PivotTable.
- PivotTable represents a PivotTable on a worksheet.
- PivotTableCollection represents a collection of all the PivotTable objects on a worksheet.
Creating a Simple Pivot Table Using Aspose.Cells
- Add data to a worksheet using the Cell object’s put_value method. This data will be used as the pivot table’s data source.
- Add a pivot table to the worksheet by calling the PivotTables collection’s add method, which is encapsulated in the Worksheet object.
- Access the new PivotTable object from the PivotTables collection by passing the PivotTable index.
- Use any of the PivotTable objects (explained above) to manage the pivot table.
After executing the example code, a pivot table is added to the worksheet.
When assigning a range of cells as the data source, the range must go from top left to bottom right. For example, “A1:C3” is valid but “C3:A1” is not.
Advance topics
- Consolidation Function
- Custom sorting in Pivot Table
- Customize Globalization Settings for Pivot Table
- Disable Pivot Table Ribbons
- Find and Refresh the Nested or Children Pivot Tables of Parent Pivot Table
- Formatting Pivot Table
- Get External Connection Data Source of Pivot Table
- Get Pivot Table refresh date and refresh by who information
- Group Pivot Fields in the Pivot Table
- Parsing Pivot Cached Records while loading Excel file
- Pivot Table and Source Data
- Pivot Table Hide and Sort data
- Refresh and Calculate Pivot Table having Calculated Items
- Save Pivot Table in ODS file
- Show report filter pages option
- Working with data display formats of DataField in Pivot Table