Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Get-OfficeExcelComment

Aliases: ExcelComments
Module PSWriteOffice
Aliases
ExcelComments
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Management.Automation.PSObject

Gets legacy worksheet comments (notes) from one or more worksheets.

Syntax

Get-OfficeExcelComment [-Address <String>] [-Author <String>] [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Context
Get-OfficeExcelComment [-Address <String>] [-Author <String>] [-Path] <String> [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Path
Get-OfficeExcelComment [-Address <String>] [-Author <String>] -Document <ExcelDocument> [-Range <String>] [-Sheet <String>] [-SheetIndex <Int32>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Find comments containing review text.

$comments = Get-OfficeExcelComment -Path .\Report.xlsx -Sheet Data -TextContains review
$comments |
    Select-Object SheetName, Address, Author, Text

Returns matching comment metadata without modifying the workbook.

Parameters

-Address String optional
A1 cell address to match.
-Author String optional
Comment author to match, ignoring case.
-Range String optional
A1 cell or range to match.
-Sheet String optional
Worksheet name to inspect. Defaults to the current DSL sheet or all workbook sheets.
-SheetIndex Int32 optional
Worksheet index (0-based) to inspect. Defaults to the current DSL sheet or all workbook sheets.
-TextContains String optional
Text fragment to match, ignoring case.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to inspect.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to inspect outside the DSL context.

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.