XLSX

Comments

Add comments and notes to cells

Adding Comments

Add comments (legacy notes in Excel) to cells in a worksheet:

{
  "worksheets": [
    {
      "name": "With Comments",
      "rows": [
        { "cells": [{ "value": "Product" }, { "value": "Price" }, { "value": "Stock" }] },
        { "cells": [{ "value": "Widget A" }, { "value": 9.99 }, { "value": 150 }] },
        { "cells": [{ "value": "Widget B" }, { "value": 14.99 }, { "value": 75 }] },
        { "cells": [{ "value": "Widget C" }, { "value": 24.99 }, { "value": 0 }] }
      ],
      "comments": [
        { "cell": "B2", "author": "Alice", "text": "Discounted from 12.99" },
        { "cell": "C3", "author": "Bob", "text": "Reorder soon" },
        { "cell": "C4", "author": "Alice", "text": "Out of stock!" }
      ]
    }
  ]
}

Comment Options Reference

OptionTypeDescription
cellstringCell reference, e.g. "B2"
authorstringComment author
textstring or objectPlain text string, or rich text object with runs
commentProbjectComment properties (anchor, locking, alignment)

Rich Text Comments

Comments support rich text formatting using the runs property. Each run has a text string and optional properties for formatting:

comments: [
  {
    cell: "B2",
    author: "Alice",
    text: {
      runs: [
        { text: "Note: ", properties: { bold: true } },
        { text: "Premium grade material" },
      ],
    },
  },
  {
    cell: "B3",
    author: "Bob",
    text: {
      runs: [
        { text: "Best seller! ", properties: { color: "008000", bold: true } },
        { text: "Consider bulk discount." },
      ],
    },
  },
],

Rich text run properties

PropertyTypeDescription
fontstringFont name
charsetnumberCharacter set
familynumberFont family
boldbooleanBold text
italicbooleanItalic text
strikebooleanStrikethrough
outlinebooleanOutline text
shadowbooleanShadow text
condensebooleanCondense text
extendbooleanExtend text
colorstringText color as hex, e.g. "FF0000"
sizenumberFont size in points
underline"single" | "double" | "singleAccounting" | "doubleAccounting" | "none"Underline style
vertAlign"superscript" | "subscript" | "baseline"Vertical alignment
scheme"major" | "minor" | "none"Font scheme

Comment properties (commentPr)

Comments can include anchor and locking settings via commentPr:

comments: [
  {
    cell: "B2",
    author: "Alice",
    text: {
      runs: [
        { text: "Note: ", properties: { bold: true } },
        { text: "Premium grade material" },
      ],
    },
    commentPr: {
      locked: false,
      autoFill: true,
      anchor: {
        moveWithCells: true,
        sizeWithCells: false,
      },
    },
  },
],

CommentPr options

PropertyTypeDescription
lockedbooleanLocked
defaultSizebooleanDefault size
printbooleanPrint with sheet
disabledbooleanDisabled
autoFillbooleanAuto fill
autoLinebooleanAuto line
altTextstringAlt text
textHAlign"left" | "center" | "right" | "justify" | "distributed"Text horizontal alignment
textVAlign"top" | "center" | "bottom" | "justify" | "distributed"Text vertical alignment
lockTextbooleanLock text
justLastXbooleanJustify last line
autoScalebooleanAuto scale
anchorObjectAnchorOptionsObject anchor position
Copyright © 2026