Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Remove-OfficeExcelComment

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument

Removes notes from a cell or all notes that match a filter.

Syntax

Remove-OfficeExcelComment
[-All]
[-Author <String>]
[-Document <ExcelDocument>]
[-PassThru]
[[-Range] <String>]
[-Sheet <OfficeSheetSelector[]>]
[-TextContains <String>]
[<CommonParameters>]
#
Parameter set: Default

Examples

Remove the note from a cell

Open-OfficeExcel -Path .\Finance\Budget-2027.xlsx {
    Remove-OfficeExcelComment B4 -Sheet Assumptions
}

Deletes the note on B4 of the Assumptions sheet.

Strip review notes before publishing

Open-OfficeExcel -Path .\Reports\Q3-Sales.xlsx {
    $removed = Remove-OfficeExcelComment -Author 'Review Bot' -PassThru
    Write-Verbose "Removed $removed review notes"
}

Removes every note left by the review bot across all sheets and reports how many were removed.

Parameters

-All SwitchParameter optional
Explicitly selects every item when no filter is supplied.
-Author String optional
Comment author to match, ignoring case.
-Document ExcelDocument optionalpipeline: True (ByValue)
Caller-owned workbook; omission uses the enclosing Excel content block.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-Range String optionalposition: 0
A1 cell range on the selected worksheet.
-Sheet OfficeSheetSelector[] optional
Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
-TextContains String optional
Text fragment to match, ignoring case.

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.