Skip to main content
PyPI package version Supported Python versions Supported Python implementations CI status of Linux/macOS/Windows Test coverage

excelrd

excelrd is a modified version of xlrd to work for the latest Python versions. xlrd will not work in Python 3.9 or newer versions.

Purpose: Provide a library for developers to use to extract data from Microsoft Excel (tm) spreadsheet files. It is not an end-user tool.

Author: John Machin

Licence: BSD-style (see licences.py)

Versions of Python supported: 3.5+.

Outside scope: excelrd will safely and reliably ignore any of these if present in the file:

  • Charts, Macros, Pictures, any other embedded object. WARNING: currently this includes embedded worksheets.

  • VBA modules

  • Formulas (results of formula calculations are extracted, of course).

  • Comments

  • Hyperlinks

  • Autofilters, advanced filters, pivot tables, conditional formatting, data validation

  • Handling password-protected (encrypted) files.

Installation

pip install excelrd

Quick start

Print all of the cell values in a specific sheet:

Sample Code:
import excelrd


def main():
    book = excelrd.open_workbook("namesdemo.xls")

    print("The number of worksheets is {}".format(book.nsheets))
    print("Worksheet name(s): {}".format(", ".join(book.sheet_names())))

    sh = book.sheet_by_index(2)
    print("{}: rows={}, cols={}".format(sh.name, sh.nrows, sh.ncols))

    for row_idx in range(sh.nrows):
        for col_idx in range(sh.ncols):
            cell = sh.cell(row_idx, col_idx)

            if not cell.value:
                continue

            print("row={}, col={}, value={}".format(row_idx, col_idx, cell.value))

Transition from xlrd to excelrd

Replace the import from import xlrd to import excelrd:

import excelrd as xlrd

Another quick start

This will show the first, second and last rows of each sheet in each file:

python PYDIR/scripts/runxlrd.py 3rows *blah*.xls

Acknowledgements

  • This package started life as a translation from C into Python of parts of a utility called “xlreader” developed by David Giffin. “This product includes software developed by David Giffin david@giffin.org.”

  • OpenOffice.org has truly excellent documentation of the Microsoft Excel file formats and Compound Document file format, authored by Daniel Rentz. See http://sc.openoffice.org

  • U+5F20 U+654F: over a decade of inspiration, support, and interesting decoding opportunities.

  • Ksenia Marasanova: sample Macintosh and non-Latin1 files, alpha testing

  • Backporting to Python 2.1 was partially funded by Journyx - provider of timesheet and project accounting solutions (http://journyx.com/).

  • Provision of formatting information in version 0.6.1 was funded by Simplistix Ltd (http://www.simplistix.co.uk/)

Documentation

https://excelrd.rtfd.io/

Metadata

Release files for excelrd 3.0.0

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

Source distribution (sdist)

Source distribution for excelrd 3.0.0
File Size Uploaded Provenance Actions
excelrd-3.0.0.tar.gz 742.8 kB Without provenance Details for excelrd-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for excelrd 3.0.0
File Interpreter ABI Platform Actions
excelrd-3.0.0-py3-none-any.whl Python 3 none any Details for excelrd-3.0.0-py3-none-any.whl

Total release size: 848.5 kB

Release files / excelrd-3.0.0.tar.gz

Download URL excelrd-3.0.0.tar.gz
Size 742.8 kB
Tags Source
SHA-256 checksum
How to use checksums
155ef640aca4f8bf2e6094a6093a9f968f3e968c88f231232b4bda4553752e35
BLAKE2b-256 checksum
How to use checksums
38f6faf728706f396c7bc5acfdb734b9043de6cac1acae9f66db347f870eaf42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / excelrd-3.0.0-py3-none-any.whl

Download URL excelrd-3.0.0-py3-none-any.whl
Size 105.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21d76a5ee0992139fb7979d736ae28d17b6369d5be897fbd963c623dbf00acc4
BLAKE2b-256 checksum
How to use checksums
d3c335576d35825191871e33398d8a09c5896588ce8fb789f458b0dbd79934cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for excelrd 3.0.0

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.

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