Skip to content

excel slicer

zmworm edited this page Apr 29, 2026 · 15 revisions

Excel: Slicer

Pivot-backed slicers — interactive filter controls attached to a pivot table field.

Path: /{SheetName}/slicer[N]

Operations

  • add - Create a slicer bound to a pivot table field
  • get, query, remove - Standard operations

add

Parent: /{SheetName}

Properties

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

get Attributes

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

Examples

# 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"

Notes

  • Slicers require an existing pivot table. The pivotTable field 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:AlternateContent for 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.

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally