Cmdlet
Remove-OfficeExcelComment
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:
DefaultExamples
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
- Explicitly selects every item when no filter is supplied.
- Comment author to match, ignoring case.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -PassThru SwitchParameter
- Emits the native result after the operation.
- -Range String
- A1 cell range on the selected worksheet.
- -Sheet OfficeSheetSelector[]
- Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.
- -TextContains String
- 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.