CommentsManager
Methods
Section titled “Methods”add(sheetName, comment): ThreadedComment;Add a new threaded comment to the given sheet.
The comment’s person (and any mentioned persons in runs) are
auto-registered into the workbook’s people list if not already present.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
comment
Section titled “comment”Returns
Section titled “Returns”ThreadedComment
the created ThreadedComment
Throws
Section titled “Throws”if the sheet does not exist
Throws
Section titled “Throws”if text is empty
Throws
Section titled “Throws”if ref is not a valid cell reference
Throws
Section titled “Throws”if datetime is provided but not a valid ISO date string
Throws
Section titled “Throws”if parentId is set but no matching comment exists
Throws
Section titled “Throws”if parentId refers to a reply (nested replies are not allowed)
Throws
Section titled “Throws”if the reply’s ref does not match the parent comment’s ref
delete()
Section titled “delete()”delete(sheetName, id): void;Delete a comment and all its replies from the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
string
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if the sheet does not exist
Throws
Section titled “Throws”if the comment is not found
get(sheetName, options): ThreadedComment[];Get all comments on the given sheet.
Copies are returned to prevent external mutation of the sheet’s comments.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
name of the sheet
options
Section titled “options”FilterOptions = {}
filtering options
Returns
Section titled “Returns”ThreadedComment[]
Throws
Section titled “Throws”if the sheet does not exist
getByCell()
Section titled “getByCell()”getByCell( sheetName, ref, options?): ThreadedComment[];Get comments attached to a specific cell on the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
name of the sheet
string
cell reference in A1 notation
options?
Section titled “options?”same filtering as get()
Returns
Section titled “Returns”ThreadedComment[]
array of comments for that cell (defensive copies)
Throws
Section titled “Throws”if the sheet does not exist
update()
Section titled “update()”update( sheetName, id, updates): void;Update an existing threaded comment on the given sheet.
Note: ref is not updatable through this API; cell moves are
handled by updateAnnotationRefs.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
string
updates
Section titled “updates”Partial<Pick<ThreadedComment, "text" | "resolved" | "runs">>
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if the sheet does not exist
Throws
Section titled “Throws”if the comment is not found
Throws
Section titled “Throws”if text is empty
Throws
Section titled “Throws”if resolved is set on a reply comment