Apple Numbers Spreadsheet Parser

4.18.2 · active · verified Thu Apr 16

numbers-parser is a Python module for reading and editing Apple Numbers .numbers files. It supports Numbers files generated by Numbers versions 3.x and later, and is tested against Numbers documents from 10.0 through to 15.1 (as of February 2026). It supports Python versions from 3.10 onwards and is actively maintained.

Common errors

Warnings

Install

Imports

Quickstart

Reads an Apple Numbers document, lists its sheets, and prints the data from the first table of the first sheet. Replace 'example.numbers' with the path to your own Numbers file. For this code to run, you need to ensure an 'example.numbers' file exists in the same directory, containing at least one sheet and one table.

from numbers_parser import Document

# Create a dummy Numbers file for demonstration
# In a real scenario, you would have an existing .numbers file.
# For this quickstart, we'll simulate a file path.
# Make sure 'mydoc.numbers' exists or replace with a real path.
# If you don't have one, create a simple one in Apple Numbers and save it.

file_path = 'example.numbers'
# You might need to create a simple example.numbers file manually
# with at least one sheet and one table for this to run.
# For example, create a new Numbers spreadsheet, add some data to Sheet 1, Table 1, and save as example.numbers.

try:
    doc = Document(file_path)
    sheets = doc.sheets
    print(f"Document has {len(sheets)} sheets.")

    if sheets:
        first_sheet = sheets[0]
        print(f"First sheet name: {first_sheet.name}")

        if first_sheet.tables:
            first_table = first_sheet.tables[0]
            print(f"First table name: {first_table.name}")
            print("Table data (first 5 rows):")
            for row_idx, row in enumerate(first_table.rows()):
                if row_idx >= 5: break
                print(f"  Row {row_idx}: {[cell.value for cell in row]}")
        else:
            print("First sheet has no tables.")
    else:
        print("Document has no sheets.")
except FileNotFoundError:
    print(f"Error: The file '{file_path}' was not found. Please create a simple .numbers file or adjust the path.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →