Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Get-OfficeExcelPivotTable

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument System.String[]

Lists pivot tables in a workbook.

Syntax

Get-OfficeExcelPivotTable
[-Document <ExcelDocument>]
[-Name <String>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: Document
Get-OfficeExcelPivotTable
[-Name <String>]
[-Path] <String[]>
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: Path
Get-OfficeExcelPivotTable
-LiteralPath <String[]>
[-Name <String>]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: LiteralPath

Examples

List pivot tables

Get-OfficeExcelPivotTable -Path .\Reports\Sales-2026.xlsx

Shows every pivot table in the workbook with its location and source.

Check where pivot tables read from

Get-OfficeExcelPivotTable -Path .\Reports\Sales-2026.xlsx |
                Select-Object Name, SheetName, Location, SourceSheet, SourceRange

Lists the source range of each pivot table, to confirm they still point at the current data after the sheet was rebuilt.

Parameters

-Document ExcelDocument optionalpipeline: True (ByValue)sets: Document
Caller-owned workbook; omission uses the enclosing Excel content block.
-Name String optional
Optional pivot table name filter.
-Sheet OfficeSheetSelector optionalaliases: WorksheetName
Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
-Path String[] requiredposition: 0pipeline: True (ByValue)aliases: FilePathsets: Path
Workbook paths resolved with filesystem wildcard support.
-LiteralPath String[] requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath
Literal workbook paths, including FileInfo.FullName and provider PSPath.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.