Note

See also Notes for worksheet and workbook note collections. Modern threaded comments use a separate Comment model.

class Note

Represents a cell Note.

Before the introduction of threaded comments, a Note was called a Comment.

Examples

import xlwings as xw

book = xw.Book()
cell = book.sheets[0]["A1"]
note = cell.add_note("Review this value")
print(note.text)

Added in version 0.24.2.

property api: Any

Returns the native object (pywin32 or appscript obj) of the engine being used.

Added in version 0.24.2.

property author: str

The note’s author. In xlwings Lite, use await get_author().

Added in version 0.37.5.

delete()

Delete the note.

Added in version 0.24.2.

async get_author()

Read the note’s author from Excel; return None if the note is gone.

Requires xlwings Lite.

Added in version 0.37.5.

Return type:

str | None

async get_location()

Read the note’s cell from Excel; return None if it is gone.

Requires xlwings Lite.

Added in version 0.37.5.

Return type:

Range | None

async get_text()

Fetch the note’s text on demand.

Requires xlwings Lite.

Added in version 0.37.0.

Return type:

str | None

property location: Range

The cell containing this note. In xlwings Lite, use await get_location().

Added in version 0.37.5.

property text: str

Gets or sets the text of a note. Keep in mind that the note must already exist!

Examples

>>> sheet = xw.Book(...).sheets[0]
>>> sheet['A1'].note.text = 'mynote'
>>> sheet['A1'].note.text
>>> 'mynote'

Added in version 0.24.2.