-
Notifications
You must be signed in to change notification settings - Fork 330
excel slicer
zmworm edited this page Apr 29, 2026
·
15 revisions
Pivot-backed slicers — interactive filter controls attached to a pivot table field.
Path: /{SheetName}/slicer[N]
- add - Create a slicer bound to a pivot table field
- get, query, remove - Standard operations
Parent: /{SheetName}
| Property | Required | Description |
|---|---|---|
pivotTable |
yes | Path to the pivot table to bind (e.g., /Sheet1/pivottable[1]) |
field |
yes | Field name from the pivot table to filter by |
name |
Custom slicer name (auto-uniquified if omitted) | |
caption |
Display caption | |
position |
Top-left cell (e.g., G1) |
|
anchor |
Cell-range anchor: G1:J10 (spans range) or G1 (single-cell top-left). Alternative to position/width/height. |
|
width |
Width (EMU or units) | |
height |
Height (EMU or units) | |
columnCount |
Number of item columns | |
rowHeight |
Row height in EMU | |
style |
Slicer style name |
| Attribute | Type | Description |
|---|---|---|
name |
string | Slicer name |
cache |
string | Slicer cache name |
caption |
string | Display caption |
field |
string | Bound pivot field name |
pivotTableName |
string | Name of bound pivot table |
itemCount |
number | Total items in the cache |
rowHeight |
string | Row height |
columnCount |
number | Number of item columns |
# Create a slicer for the Region field on pivot table 1
officecli add data.xlsx /Sheet1 --type slicer \
--prop pivotTable=/Sheet1/pivottable[1] \
--prop field=Region
# With position and size
officecli add data.xlsx /Sheet1 --type slicer \
--prop pivotTable=/Sheet1/pivottable[1] \
--prop field=Category \
--prop position=G1 \
--prop width=5cm --prop height=8cm
# Query all slicers
officecli query data.xlsx "slicer"- Slicers require an existing pivot table. The
pivotTablefield must reference a valid/Sheet/pivottable[N]path. - Internally creates six XML parts: SlicerCachePart, SlicersPart, workbook + worksheet extLst registrations, and a drawing anchor with
mc:AlternateContentfor older Excel clients. - Slicer names are auto-uniquified across the workbook when the same field is sliced twice.
- Older Excel clients display a placeholder rectangle via the Fallback branch.
- Pivot Table - Required backing element
- Excel Reference - All Excel elements
Based on OfficeCLI v1.0.64