A note is Excel 365's name for the classic cell comment: a text box with an author name. setComment(cell, comment) writes one and null removes it. A note without an author reads back with authornull (Python None), as every absent value does; an empty author string is stored as no author. listComments() returns every note on the sheet with its cell. A note is hidden until the pointer rests on the cell; setCommentVisible keeps it shown.
Every threaded comment names its author by a person id from the workbook's person list. wb.addPerson adds a person and returns the id, a GUID in braces generated when you omit id. userId and providerId identify the account behind the name; leave them out for a person with no account.
import refrom formulon import PersonInput, Workbookwith Workbook.create_default() as wb: ann = wb.add_person(PersonInput(display_name="Ann Lee")) wb.add_person(PersonInput(display_name="Bob Kim", user_id="[email protected]", provider_id="None")) print(bool(re.fullmatch(r"\{[0-9A-F-]{36}\}", ann))) # True print(",".join(p.display_name for p in wb.list_people())) # Ann Lee,Bob Kim print(wb.get_person(ann).user_id) # None
addThreadedComment with a cell opens a thread there and returns the comment's id. A comment with a parentId is a reply to that thread, and its cell is ignored. listThreadedComments(cell) returns the thread in order, the opening comment first. created is the timestamp; the next section explains how it is read.
js
import createFormulon from '@libraz/formulon'const formulon = await createFormulon()const wb = formulon.Workbook.createDefault()try { const ws = wb.sheet(0) const ann = wb.addPerson({ displayName: 'Ann Lee' }) const bob = wb.addPerson({ displayName: 'Bob Kim' }) const thread = ws.addThreadedComment({ cell: 'C3', personId: ann, text: 'Is this total final?', created: new Date('2026-11-07T09:30:00Z'), }) ws.addThreadedComment({ parentId: thread, personId: bob, text: 'Yes, signed off.', created: new Date('2026-11-07T10:05:00Z'), }) const comments = ws.listThreadedComments('C3') console.log(comments.length) // 2 console.log(comments[1].text, comments[1].parentId === thread) // Yes, signed off. true console.log(wb.getPerson(comments[1].personId).displayName) // Bob Kim} finally { wb.dispose()}
python
from datetime import datetime, timezonefrom formulon import PersonInput, ThreadedCommentInput, Workbookwith Workbook.create_default() as wb: ws = wb[0] ann = wb.add_person(PersonInput(display_name="Ann Lee")) bob = wb.add_person(PersonInput(display_name="Bob Kim")) thread = ws.add_threaded_comment(ThreadedCommentInput( cell="C3", person_id=ann, text="Is this total final?", created=datetime(2026, 11, 7, 9, 30, tzinfo=timezone.utc), )) ws.add_threaded_comment(ThreadedCommentInput( parent_id=thread, person_id=bob, text="Yes, signed off.", created=datetime(2026, 11, 7, 10, 5, tzinfo=timezone.utc), )) comments = ws.list_threaded_comments("C3") print(len(comments)) # 2 print(comments[1].text, comments[1].parent_id == thread) # Yes, signed off. True print(wb.get_person(comments[1].person_id).display_name) # Bob Kim
save() writes each thread together with a note that tells older versions of Excel the cell holds a threaded comment. listComments() does not list those placeholder notes.
created is stored in UTC, and it is the one date input that reads a JavaScript Date through its UTC getters. Every other Date input, such as a cell value or a pinned clock, reads the local getters. So build a created value with Date.UTC(...) or an ISO string ending in Z, and build a cell date with new Date(year, monthIndex, day).
A CivilTime record passed as created is taken as UTC. Python reads a naive datetime in created as UTC and converts an aware one. Seconds are kept and milliseconds are dropped.
An omitted created is the current UTC time. When the workbook has a pinned clock (setPinnedNow), that wall-clock time is written as given, without conversion.
js
import createFormulon from '@libraz/formulon'const formulon = await createFormulon()const wb = formulon.Workbook.createDefault()try { const ws = wb.sheet(0) const ann = wb.addPerson({ displayName: 'Ann Lee' }) const id = ws.addThreadedComment({ cell: 'B2', personId: ann, text: 'Logged at 09:30 UTC', created: new Date(Date.UTC(2026, 10, 7, 9, 30)), }) console.log(JSON.stringify(ws.getThreadedComment(id).created)) // {"year":2026,"month":11,"day":7,"hour":9,"minute":30,"second":0} ws.setValue('A1', new Date(2026, 10, 7, 9, 30)) const local = ws.getDate('A1') console.log(local.getHours(), local.getMinutes()) // 9 30} finally { wb.dispose()}
A mention ties a span of the comment text to a person: start and end are the half-open span [start, end), and the span usually covers the @Name text. Each binding counts the span in its own string indices: JavaScript in UTF-16 code units, as indexOf, length and slice do, and Python in code points, as str.index, len and slicing do.
The offsets of the same text differ between the two when it holds a character outside the Basic Multilingual Plane, such as most emoji, and neither needs a conversion.
updateThreadedComment(id, patch) changes a comment's text and mentions, and done resolves or reopens a thread; done is accepted on the opening comment only. removeThreadedComment(id) removes one comment.
js
import createFormulon from '@libraz/formulon'const formulon = await createFormulon()const wb = formulon.Workbook.createDefault()try { const ws = wb.sheet(0) const ann = wb.addPerson({ displayName: 'Ann Lee' }) const thread = ws.addThreadedComment({ cell: 'C3', personId: ann, text: 'Is this total final?' }) const reply = ws.addThreadedComment({ parentId: thread, personId: ann, text: 'Draft reply' }) ws.updateThreadedComment(reply, { text: 'Yes, signed off.' }) ws.updateThreadedComment(thread, { done: true }) console.log(ws.getThreadedComment(thread).done) // true console.log(ws.getThreadedComment(reply).text) // Yes, signed off. ws.removeThreadedComment(reply) console.log(ws.listThreadedComments('C3').length) // 1} finally { wb.dispose()}
python
from formulon import PersonInput, ThreadedCommentInput, Workbookwith Workbook.create_default() as wb: ws = wb[0] ann = wb.add_person(PersonInput(display_name="Ann Lee")) thread = ws.add_threaded_comment(ThreadedCommentInput(cell="C3", person_id=ann, text="Is this total final?")) reply = ws.add_threaded_comment(ThreadedCommentInput(parent_id=thread, person_id=ann, text="Draft reply")) ws.update_threaded_comment(reply, text="Yes, signed off.") ws.update_threaded_comment(thread, done=True) print(ws.get_threaded_comment(thread).done) # True print(ws.get_threaded_comment(reply).text) # Yes, signed off. ws.remove_threaded_comment(reply) print(len(ws.list_threaded_comments("C3"))) # 1
Add notes and threaded comments
Use this page to annotate cells the way Excel 365 does, with plain notes or with conversation threads that name their authors and mention other people. Comments and notes covers the model, and the calls are under Comments and hyperlinks and Threaded comments and persons in the WASM API and the Python API.
Add a note
A note is Excel 365's name for the classic cell comment: a text box with an author name.
setComment(cell, comment)writes one andnullremoves it. A note without an author reads back withauthornull(PythonNone), as every absent value does; an empty author string is stored as no author.listComments()returns every note on the sheet with its cell. A note is hidden until the pointer rests on the cell;setCommentVisiblekeeps it shown.A cell holds either a note or a thread, never both. Adding one to a cell that holds the other fails with
StatusCode.AlreadyExists.Register the people
Every threaded comment names its author by a person id from the workbook's person list.
wb.addPersonadds a person and returns the id, a GUID in braces generated when you omitid.userIdandproviderIdidentify the account behind the name; leave them out for a person with no account.Start a thread and reply
addThreadedCommentwith acellopens a thread there and returns the comment's id. A comment with aparentIdis a reply to that thread, and itscellis ignored.listThreadedComments(cell)returns the thread in order, the opening comment first.createdis the timestamp; the next section explains how it is read.save()writes each thread together with a note that tells older versions of Excel the cell holds a threaded comment.listComments()does not list those placeholder notes.Set the timestamp in UTC
createdis stored in UTC, and it is the one date input that reads a JavaScriptDatethrough its UTC getters. Every otherDateinput, such as a cell value or a pinned clock, reads the local getters. So build acreatedvalue withDate.UTC(...)or an ISO string ending inZ, and build a cell date withnew Date(year, monthIndex, day).A
CivilTimerecord passed ascreatedis taken as UTC. Python reads a naivedatetimeincreatedas UTC and converts an aware one. Seconds are kept and milliseconds are dropped.An omitted
createdis the current UTC time. When the workbook has a pinned clock (setPinnedNow), that wall-clock time is written as given, without conversion.createdreads back in UTC: aCivilTimerecord in JavaScript and a naivedatetimein Python. Convert it to the reader's zone for display.Mention a person
A mention ties a span of the comment text to a person:
startandendare the half-open span[start, end), and the span usually covers the@Nametext. Each binding counts the span in its own string indices: JavaScript in UTF-16 code units, asindexOf,lengthandslicedo, and Python in code points, asstr.index,lenand slicing do.The offsets of the same text differ between the two when it holds a character outside the Basic Multilingual Plane, such as most emoji, and neither needs a conversion.
Resolve, edit and remove
updateThreadedComment(id, patch)changes a comment'stextandmentions, anddoneresolves or reopens a thread;doneis accepted on the opening comment only.removeThreadedComment(id)removes one comment.