ExcelScript.Comment interface

Represents a comment in the workbook.

Methods

addCommentReply(content, contentType)

Creates a comment reply for a comment.

delete()

Deletes the comment and all the connected replies.

getAuthorEmail()

Gets the email of the comment's author.

getAuthorName()

Gets the name of the comment's author.

getCommentReply(commentReplyId)

Returns a comment reply identified by its ID. If the comment reply object does not exist, then this method returns undefined.

getContent()

The comment's content. The string is plain text.

getContentType()

Gets the content type of the comment.

getCreationDate()

Gets the creation time of the comment. Returns null if the comment was converted from a note, since the comment does not have a creation date.

getId()

Specifies the comment identifier.

getLocation()

Gets the cell where this comment is located.

getMentions()

Gets the entities (e.g., people) that are mentioned in comments.

getReplies()

Represents a collection of reply objects associated with the comment.

getResolved()

The comment thread status. A value of true means that the comment thread is resolved.

getRichContent()

Gets the rich comment content (e.g., mentions in comments). This string is not meant to be displayed to end-users. Your add-in should only use this to parse rich comment content.

setContent(content)

The comment's content. The string is plain text.

setResolved(resolved)

The comment thread status. A value of true means that the comment thread is resolved.

updateMentions(contentWithMentions)

Updates the comment content with a specially formatted string and a list of mentions.

Method Details

addCommentReply(content, contentType)

Creates a comment reply for a comment.

addCommentReply(
            content: CommentRichContent | string,
            contentType?: ContentType
        ): CommentReply;

Parameters

content

ExcelScript.CommentRichContent | string

The comment's content. This can be either a string or a CommentRichContent object (e.g., for comments with mentions).

contentType
ExcelScript.ContentType

Optional. The type of content contained within the comment. The default value is enum ContentType.Plain.

Returns

delete()

Deletes the comment and all the connected replies.

delete(): void;

Returns

void

getAuthorEmail()

Gets the email of the comment's author.

getAuthorEmail(): string;

Returns

string

getAuthorName()

Gets the name of the comment's author.

getAuthorName(): string;

Returns

string

getCommentReply(commentReplyId)

Returns a comment reply identified by its ID. If the comment reply object does not exist, then this method returns undefined.

getCommentReply(commentReplyId: string): CommentReply | undefined;

Parameters

commentReplyId

string

The identifier for the comment reply.

Returns

getContent()

The comment's content. The string is plain text.

getContent(): string;

Returns

string

getContentType()

Gets the content type of the comment.

getContentType(): ContentType;

Returns

getCreationDate()

Gets the creation time of the comment. Returns null if the comment was converted from a note, since the comment does not have a creation date.

getCreationDate(): Date;

Returns

Date

getId()

Specifies the comment identifier.

getId(): string;

Returns

string

getLocation()

Gets the cell where this comment is located.

getLocation(): Range;

Returns

getMentions()

Gets the entities (e.g., people) that are mentioned in comments.

getMentions(): CommentMention[];

Returns

getReplies()

Represents a collection of reply objects associated with the comment.

getReplies(): CommentReply[];

Returns

getResolved()

The comment thread status. A value of true means that the comment thread is resolved.

getResolved(): boolean;

Returns

boolean

getRichContent()

Gets the rich comment content (e.g., mentions in comments). This string is not meant to be displayed to end-users. Your add-in should only use this to parse rich comment content.

getRichContent(): string;

Returns

string

setContent(content)

The comment's content. The string is plain text.

setContent(content: string): void;

Parameters

content

string

Returns

void

setResolved(resolved)

The comment thread status. A value of true means that the comment thread is resolved.

setResolved(resolved: boolean): void;

Parameters

resolved

boolean

Returns

void

updateMentions(contentWithMentions)

Updates the comment content with a specially formatted string and a list of mentions.

updateMentions(contentWithMentions: CommentRichContent): void;

Parameters

contentWithMentions
ExcelScript.CommentRichContent

The content for the comment. This contains a specially formatted string and a list of mentions that will be parsed into the string when displayed by Excel.

Returns

void