Skip to main content

xlsx-reader

Python3 library optimised for reading very large Excel XLSX files, including those with hundreds of columns as well as rows.

Simple example

from xlsxr import Workbook

workbook = Workbook(filename="myworkbook.xlsx", convert_values=True)

for sheet in workbook.sheets:
    print("Sheet ", sheet.name)
    for row in sheet.rows:
        print(row)

Conversions

By default, everything is a string, and all dates and datetimes will appear in ISO 8601 format (YYYY-mm-dd or YYYY-mm-ddTHH:MM:SS). If you supply the option convert_values to the Worksheet constructor, the library will convert numbers to ints or floats, and dates to datetime.datetime or datetime.date objects. There is no attempt to handle standalone times.

Empty cells appear as the empty string ''.

xlsxr.workbook.Workbook class

Constructor

The xlsxr.Workbook class constructor takes the following keyword arguments:

Argument Description
filename Path to an Excel file on the local filesystem.
stream A file-like object (byte stream)
url The URL of a remote Excel file
convert_values If True, convert numbers and dates from strings to Python values (default is False)
fill_merged If True, repeat values to fill merged areas (default is False)

You may specify only one of filename, stream, or url.

Properties

Property Description
sheets A list of xlsxr.sheet.Sheet objects
styles A list of xlsxr.style.Style objects

xlsxr.sheet.Sheet class

Properties

Property | Description workbook | The parent Workbook objet name | The name of the sheet sheet_id | The internal identifier of the sheet state | The state of the sheet (normally 'visible' or 'hidden') relation_id | ?? cols | A list of metadata for each column. rows | A list of the data rows in the sheet (parsed on demand). merges | A list of merges in the sheet (parsed on demand).

Each row is a list of scalar values. The will all be strings or None unless you specified the convert_values option for the Workbook.

Merges appear as strings defining ranges, e.g. "A1:C3".

Columns

Columns are represented as dict objects with the following properties:

Key Description
collapsed True if the column is collapsed.
hidden True if the column is hidden
min ??
max ??
style A key into the styles property of the workbook.

xlsxr.style.Style class

Properties

Property Description
number_formats ??
cell_style_formats ??
cell_formats ??
cell_styles ??

License

This is free and unencumbered software released into the public domain. See UNLICENSE.md for details.

Metadata

Release files for xlsxr 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xlsxr 0.1
File Size Uploaded Provenance Actions
xlsxr-0.1.tar.gz 8.8 kB Without provenance Details for xlsxr-0.1.tar.gz

Release files / xlsxr-0.1.tar.gz

Download URL xlsxr-0.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
918612299c93c3cbed256840fd21ddfc3edb3f59f80b27980d9519b642eb630a
BLAKE2b-256 checksum
How to use checksums
e8d06cc555320e30342b2efea31d3ad0d8da7b7cc00ed89970387db6bddd1882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for xlsxr 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page