typed-xlsx
Columns

Cell Notes

Attach Excel notes to header cells and body cells, with text per cell and an optional author.

A note is the small yellow box Excel shows when the pointer rests on a cell with a red corner. Use headerNote to explain a column, and note to flag single cells.

import { 
createExcelSchema
} from "typed-xlsx";
type
Invoice
= {
id
: string;
amount
: number;
previousAmount
?: number };
const
schema
=
createExcelSchema
<
Invoice
>()
.
column
("id", {
header
: "Invoice",
accessor
: "id" })
.
column
("amount", {
header
: "Amount",
accessor
: "amount",
headerNote
: "In EUR, excluding VAT",
note
: ({
row
}) =>
row
.
previousAmount
=== undefined
? undefined : {
text
: `Changed by hand, was ${
row
.
previousAmount
}`,
author
: "Finance" },
}) .
build
();

note takes:

  • a string, written on every body cell of the column
  • { text, author? }, the same with an author
  • ({ row, rowIndex, subRowIndex, ctx, value }) => string | { text, author? } | null | undefined, called for each cell

value is what the cell holds. Returning undefined, null or an empty string leaves that cell without a note. headerNote takes a string or { text, author? }.

On an expanded row, the callback runs for each physical row. A column with one value is merged across the record's rows, and its note goes on the merged cell only.

The author is stored with the note; notes without one share an empty author. A note longer than 32,767 characters follows the workbook's textOverflow policy, like a cell.

In Excel

Notes are the classic Excel notes (called comments before Excel 365), not threaded comments. They are written with the VML drawing Excel uses to display them, which LibreOffice reads too.

Streaming

In a streamed workbook, each note is written to a temporary file next to the table's rows as it is committed, and read back when the workbook is finished. Only the list of authors stays in memory, so notes on every row of a large export do not grow memory. The cost is one more temporary file per table that has notes, about 30 bytes plus the note text per note, and two reads of that file at the end (one for the notes, one for their drawing). With tempStorage: "memory" the notes are kept in memory like the rows.

Copyright © 2026 Cyprien Thao. Released under the MIT License.