Cmdlet
Update-OfficeExcelComment
Replaces the text or author of notes that match a filter.
Syntax
Update-OfficeExcelComment
[-All]
[-Author <String>]
[-Document <ExcelDocument>]
[-Initials <String>]
[-MatchAuthor <String>]
[-PassThru]
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-Text <String>]
[-TextContains <String>]
[<CommonParameters>]#Parameter set:
TextUpdate-OfficeExcelComment
[-All]
[-Author <String>]
[-Content] <ScriptBlock>
[-Document <ExcelDocument>]
[-Initials <String>]
[-MatchAuthor <String>]
[-PassThru]
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-TextContains <String>]
[<CommonParameters>]#Parameter set:
RichTextExamples
Change the text of matching notes
Open-OfficeExcel -Path .\Finance\Budget-2027.xlsx {
Update-OfficeExcelComment -Sheet Assumptions -TextContains 'TBD' -Text 'Confirmed with the vendor on 24 October.'
}Replaces the text of every note that says TBD on the Assumptions sheet.
Hand notes over to a new owner
Open-OfficeExcel -Path .\Reports\Helpdesk.xlsx {
Update-OfficeExcelComment -MatchAuthor 'jnowak' -Author 'Service Desk' -Initials 'SD'
Update-OfficeExcelComment -Sheet Tickets -Range F40 {
ExcelText 'Escalated: ' -Bold -Color Danger
ExcelText 'vendor case 88412 opened.'
}
}Moves every note written by a departing colleague to the team account and rewrites one escalation note with rich text.
Parameters
- -All SwitchParameter
- Explicitly selects every item when no filter is supplied.
- Replacement author name.
- -Document ExcelDocument
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -Initials String
- Author initials, supplied together with Author.
- Existing comment author to match, ignoring case.
- -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.
- -Text String
- Replacement plain text.
- -TextContains String
- Existing text fragment to match, ignoring case.
- -Content ScriptBlock
- Excel child commands executed in the current content scope.
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.