Introduction

aspose-note is a free, MIT-licensed Python package for reading Microsoft OneNote .one files. This guide covers exactly what you need to install it from PyPI and start reading notebooks: opening a file, walking its document tree, and pulling out rich text, images, attachments, and tables.

pip install aspose-note

No Microsoft Office installation, COM automation, or platform-native DLL is required — the package is a pure-Python implementation of the MS-ONE/OneStore binary format, and it runs the same way on Windows, macOS, and Linux.


Opening a .one File

Pass a file path (or any binary stream) to Document to load a OneNote 2007, 2010, or Online section file:

from aspose.note import Document

doc = Document("MyNotes.one")

Walking the Document Tree

The document is exposed as a tree — Document → Page → Outline → OutlineElement → RichText / Image / Table / AttachedFile. GetChildNodes(Type) performs a recursive, type-filtered search anywhere in that tree, so you rarely need to walk each level by hand:

from aspose.note import Document, RichText

doc = Document("MyNotes.one")
all_text = [rt.Text for rt in doc.GetChildNodes(RichText) if rt.Text]

Reading Rich Text

Each RichText node holds a list of TextRun segments, and every run carries its own TextStyle — bold, italic, underline, font name, font color, and hyperlink address:

from aspose.note import Document, RichText

doc = Document("MyNotes.one")
for rt in doc.GetChildNodes(RichText):
    for run in rt.TextRuns:
        if run.Style.IsHyperlink:
            print(f"  Link: {run.Text} -> {run.Style.HyperlinkAddress}")
        elif run.Style.IsBold:
            print(f"  Bold: {run.Text}")

Reading Images and Attachments

Image and AttachedFile nodes expose their raw bytes and original filename, so both can be written back to disk as-is:

from aspose.note import Document, Image, AttachedFile

doc = Document("MyNotes.one")
for img in doc.GetChildNodes(Image):
    with open(img.FileName or "image.bin", "wb") as f:
        f.write(img.Bytes)

for af in doc.GetChildNodes(AttachedFile):
    with open(af.FileName or "attachment.bin", "wb") as f:
        f.write(af.Bytes)

Parsing Tables

Tables nest as Table → TableRow → TableCell, and each cell’s text is read the same way as any other RichText content:

from aspose.note import Document, Table, TableRow, TableCell, RichText

doc = Document("MyNotes.one")
for table in doc.GetChildNodes(Table):
    for row in table.GetChildNodes(TableRow):
        cells = [
            " ".join(rt.Text for rt in cell.GetChildNodes(RichText))
            for cell in row.GetChildNodes(TableCell)
        ]
        print(cells)

What’s Next

This guide covers reading only. To export what you’ve read to PDF, see Exporting OneNote Files to PDF in Python. For a full tour of the library — including building a notebook from scratch — see Introducing Aspose.Note FOSS for Python.


Get Started