The workbook model keeps cell notes, threaded discussions and people apart. This page covers all three; pictures, charts and other drawing objects are on Images and drawings.
Add a note to a cell
A1:B4 holds a small expense list. Notes attach text to a cell without changing its value.
Powered by the real Formulon engine (WASM) — it runs entirely in your browser, nothing is uploaded.
ws.listThreadedComments() returns a flat file-order list: each thread opener is followed by its replies. ws.listThreadedComments('B2'), or (row, col), lists only the thread at that cell, and [] when it has none. Python spells it list_threaded_comments(cell=None).
A ThreadedComment carries these fields:
Field
Meaning
id
A GUID string in braces
cell
The anchor, a zero-based CellAddress
personId
The person id
created
The timestamp, a CivilTime (Python datetime); null when the file has none or it cannot be parsed. The hundredths of a second are dropped
text
The comment text
parentId
Empty on an opener
done
The resolved state
mentions
The mention spans, in UTF-16 code units in JavaScript and code points in Python
Offsets count a line break as one character. The .xlsx file counts it as two, and a load and a save convert between the two, so a mention after a line break keeps its place.
ws.addThreadedComment(comment) opens a thread at cell when parentId is empty or omitted. Otherwise it adds a reply and ignores cell. Two of its keys take several forms:
Key
Accepts
created
A CivilTime (read as UTC), a Date (read through its UTC getters) or null (the pinned clock, else now). Python converts an aware datetime to UTC and reads a naive datetime or a date as UTC
cell
A CellAddress or an A1 cell (A1 when omitted)
ws.updateThreadedComment(id, patch) changes the text, the mentions or the resolved state. done is accepted on a thread's opening comment only.
ws.removeThreadedComment(id) removes a comment. Removing an opener removes its whole thread.
Each thread keeps Excel's legacy note stub synchronized. Saving .xlsx writes that note in the UI language of the profile's locale, as one plain run with CRLF line breaks. A save orders a thread's replies by creation time and then id, as Excel does on save.
The thread's own text is written with CRLF line breaks and its replies in the same order. The Japanese wording is measured; the other languages use the wording Excel ships for that UI language. Row and column insertions and deletions move or remove comment anchors with their cells.
Classic notes remain available through these members:
Member
Does
ws.getComment(row, col)
Returns the note, or null (Python None) when no note is anchored at the cell
ws.listComments()
Lists the notes, including those anchored on otherwise-empty cells
ws.setComment(row, col, comment)
Sets a note; comment is { text, author? }
ws.setComment(row, col, null)
Removes a note, and does nothing when there is none
An omitted or empty author means none and reads back as null. Python spells the comment Comment(text), and its author reads None. An empty text passed to setComment writes an empty note.
A note loaded from a file keeps its formatted runs, each with its own font, through a save. Setting a note's text through the API replaces them with plain text.
ws.getCommentVisible(row, col) reports whether a note is shown without hovering. It returns a Boolean, or null when no note is anchored there. ws.setCommentVisible(row, col, visible) shows or hides the note while keeping the note's box geometry.
Condition
JavaScript
Python
setCommentVisible where no note is anchored
Throws StatusCode.NotFound
set_comment_visible() raises NotFoundError
getCommentVisible where no note is anchored
null
get_comment_visible() returns None (a bool otherwise)
A resave keeps each note's box (x:Anchor), its visibility, and the authors table of the comments part, including authors no remaining note names. Adding, removing, or showing a note regenerates the drawing without resetting the other notes' boxes or visibility, and a box follows its note through row and column edits.
Each remaining note re-emits its own original <v:shape> (fill, stroke, shadow, text-box style, font, size) with only its anchor, visibility, and cell patched. A new note gets the default shape.
The C calls are fm_sheet_get_threaded_comment_count, fm_sheet_get_threaded_comment_at, fm_sheet_add_threaded_comment, fm_sheet_update_threaded_comment, fm_sheet_remove_threaded_comment, fm_workbook_get_person_count, fm_workbook_get_person_at, fm_workbook_add_person, and fm_workbook_remove_person. WASM and Native Node use the matching camelCase methods; Python uses snake_case.
Comments and notes
The workbook model keeps cell notes, threaded discussions and people apart. This page covers all three; pictures, charts and other drawing objects are on Images and drawings.
Add a note to a cell
A1:B4 holds a small expense list. Notes attach text to a cell without changing its value.
Powered by the real Formulon engine (WASM) — it runs entirely in your browser, nothing is uploaded.
What you can do
Reading threads
ws.listThreadedComments()returns a flat file-order list: each thread opener is followed by its replies.ws.listThreadedComments('B2'), or(row, col), lists only the thread at that cell, and[]when it has none. Python spells itlist_threaded_comments(cell=None).A
ThreadedCommentcarries these fields:idcellCellAddresspersonIdcreatedCivilTime(Pythondatetime);nullwhen the file has none or it cannot be parsed. The hundredths of a second are droppedtextparentIddonementionsOffsets count a line break as one character. The
.xlsxfile counts it as two, and a load and a save convert between the two, so a mention after a line break keeps its place.Adding, updating and removing comments
ws.addThreadedComment(comment)opens a thread atcellwhenparentIdis empty or omitted. Otherwise it adds a reply and ignorescell. Two of its keys take several forms:createdCivilTime(read as UTC), aDate(read through its UTC getters) ornull(the pinned clock, else now). Python converts an awaredatetimeto UTC and reads a naivedatetimeor adateas UTCcellCellAddressor an A1 cell (A1 when omitted)ws.updateThreadedComment(id, patch)changes thetext, thementionsor the resolved state.doneis accepted on a thread's opening comment only.ws.removeThreadedComment(id)removes a comment. Removing an opener removes its whole thread.People
wb.listPeople()reads the workbook person list andwb.addPerson(person)adds one. The person fields behave as follows:displayNameididis generated as a GUIDuserId,providerIdnullwhen omittedAn empty
idorproviderIdfails withStatusCode.InvalidArgument.wb.removePerson(id)fails in these cases:StatusCode.InvalidArgumentStatusCode.NotFoundSaving threads
Each thread keeps Excel's legacy note stub synchronized. Saving
.xlsxwrites that note in the UI language of the profile's locale, as one plain run with CRLF line breaks. A save orders a thread's replies by creation time and then id, as Excel does on save.The thread's own text is written with CRLF line breaks and its replies in the same order. The Japanese wording is measured; the other languages use the wording Excel ships for that UI language. Row and column insertions and deletions move or remove comment anchors with their cells.
Notes
Classic notes remain available through these members:
ws.getComment(row, col)null(PythonNone) when no note is anchored at the cellws.listComments()ws.setComment(row, col, comment)commentis{ text, author? }ws.setComment(row, col, null)An omitted or empty
authormeans none and reads back asnull. Python spells the commentComment(text), and itsauthorreadsNone. An emptytextpassed tosetCommentwrites an empty note.A note loaded from a file keeps its formatted runs, each with its own font, through a save. Setting a note's text through the API replaces them with plain text.
Note visibility
ws.getCommentVisible(row, col)reports whether a note is shown without hovering. It returns a Boolean, ornullwhen no note is anchored there.ws.setCommentVisible(row, col, visible)shows or hides the note while keeping the note's box geometry.setCommentVisiblewhere no note is anchoredStatusCode.NotFoundset_comment_visible()raisesNotFoundErrorgetCommentVisiblewhere no note is anchorednullget_comment_visible()returnsNone(a bool otherwise)Resaving notes
A resave keeps each note's box (
x:Anchor), its visibility, and the authors table of the comments part, including authors no remaining note names. Adding, removing, or showing a note regenerates the drawing without resetting the other notes' boxes or visibility, and a box follows its note through row and column edits.Each remaining note re-emits its own original
<v:shape>(fill, stroke, shadow, text-box style, font, size) with only its anchor, visibility, and cell patched. A new note gets the default shape.Threaded comment and person bindings
The C calls are
fm_sheet_get_threaded_comment_count,fm_sheet_get_threaded_comment_at,fm_sheet_add_threaded_comment,fm_sheet_update_threaded_comment,fm_sheet_remove_threaded_comment,fm_workbook_get_person_count,fm_workbook_get_person_at,fm_workbook_add_person, andfm_workbook_remove_person. WASM and Native Node use the matching camelCase methods; Python uses snake_case.Read next
.xlsb(Saving to XLSB).