Skip to main content

Library for developers to extract data from Microsoft Excel (tm) spreadsheet files

Project description

PyPI package version Supported Python versions CI status Test coverage

excelrd

excelrd is a modified version of xlrd to work for the latest Python.

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.

Quick start

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))

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/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excelrd-2.0.2.tar.gz (761.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

excelrd-2.0.2-py3-none-any.whl (105.4 kB view details)

Uploaded Python 3

File details

Details for the file excelrd-2.0.2.tar.gz.

File metadata

  • Download URL: excelrd-2.0.2.tar.gz
  • Upload date:
  • Size: 761.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for excelrd-2.0.2.tar.gz
Algorithm Hash digest
SHA256 280785cbc56d1036dce93a3fbd97ff99d4571c99707b6f16326a758e473f508c
MD5 9c03ccb66188c39643761ca6926c46be
BLAKE2b-256 a6c3ad4fd6742766ba7b642a8081549e74130b1ceca0137b4cc5ae4d3eef202e

See more details on using hashes here.

File details

Details for the file excelrd-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: excelrd-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 105.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for excelrd-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6a712e1f78374f9dac8187b2e7f79e8e92d5a00dc28ec6d11ac21df5267a90c
MD5 5188d7899bf333667cf36cfb6e1ec2bb
BLAKE2b-256 ee338b5c1179e46e060a86f6f831d1200e587c290e15990eb3d6933195a6c2fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page