Pivot Tables (Python)
The scripting facility allows you to do most of the things you can do in the pivot table editor, through use of the SpssPivotTable class. There are two general approaches for working with pivot tables from scripting:
- Select groups of cells (results or labels) or other elements (such as footnotes) and apply methods that modify the entire selection. For example, you can change the foreground color for selected cells.
- Access a subset of the pivot table, such as its data cells or row labels, and modify a particular element in the subset. For example, you can access the data cells and call a method to set the foreground color for a specified cell.
Generally speaking, if you want to modify a number of elements in the same manner, the first approach is faster.
Areas of a Pivot Table
(Red labels indicate accessible objects.)
Available Objects
The SpssPivotTable object provides access to the following objects:
- SpssDataCells Provides access to the data cells.
- SpssLabels Provides access to the row and column labels.
- SpssFootnotes Provides access to all of the table's footnotes.
- SpssLayerLabels Provides access to labels in any layer dimensions.
- SpssPivotMgr Provides access to row, column, and layer dimensions.
- SpssDimension Provides access to the properties of a particular dimension.