Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelThreadedComment

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

Adds a threaded comment or reply to an Excel worksheet.

Syntax

Add-OfficeExcelThreadedComment -Address <String> [-Author <String>] [-Date <DateTime>] [-Done] [-Id <String>] [-ParentId <String>] [-PassThru] -Text <String> [<CommonParameters>]
#
Parameter set: Context
Add-OfficeExcelThreadedComment -Address <String> [-Author <String>] [-Date <DateTime>] [-Done] [-Id <String>] [-NoSave] [-ParentId <String>] [-PassThru] [-Path] <String> [-Sheet <String>] [-SheetIndex <Int32>] -Text <String> [<CommonParameters>]
#
Parameter set: Path
Add-OfficeExcelThreadedComment -Address <String> [-Author <String>] [-Date <DateTime>] -Document <ExcelDocument> [-Done] [-Id <String>] [-ParentId <String>] [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] -Text <String> [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Add a threaded review note and audit it before sharing.

$comment = Add-OfficeExcelThreadedComment -Path .\Review.xlsx -Sheet Data -Address C5 -Text 'Please confirm this variance.' -Author 'Finance Reviewer' -PassThru
Add-OfficeExcelThreadedComment -Path .\Review.xlsx -Sheet Data -Address C5 -Text 'Confirmed with sales ops.' -Author 'Report Owner' -ParentId $comment.Id
Get-OfficeExcelCommentAudit -Path .\Review.xlsx -IncludeComments |
    Select-Object -ExpandProperty ThreadedComments

Uses OfficeIMO threaded-comment metadata authoring, including workbook person metadata, and keeps legacy notes separate.

Parameters

-Address String required
A1-style cell address, such as C5.
-Author String optional
Author display name stored in workbook person metadata.
-Date DateTime optional
Optional timestamp for the threaded comment.
-Done SwitchParameter optional
Mark the threaded comment as done/resolved.
-Id String optional
Optional stable threaded-comment id.
-ParentId String optional
Optional parent threaded-comment id when adding a reply.
-PassThru SwitchParameter optional
Emit threaded-comment metadata.
-Text String required
Threaded comment text.
-NoSave SwitchParameter optionalsets: Path
Do not save when operating on a path-owned workbook.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Sheet String optionalsets: Path, Document
Worksheet name when using path or document input.
-SheetIndex Int32 optionalsets: Path, Document
Worksheet index (0-based) when using path or document input.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to operate on 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.