Skip to main content

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

Project description

Build Status Coverage Status Documentation PyPI version

xlrd is a library for reading data and formatting information from Excel files in the historical .xls format.

The following are also not supported but will safely and reliably be ignored:

  • Charts, Macros, Pictures, any other embedded object, including embedded worksheets.

  • VBA modules

  • Formulas, but results of formula calculations are extracted.

  • Comments

  • Hyperlinks

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

Password-protected files are not supported and cannot be read by this library.

Quick start:

pip install xlrd2
import xlrd
book = xlrd.open_workbook("myfile.xls")
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
for rx in range(sh.nrows):
    print(sh.row(rx))

From the command line, this will show the first, second and last rows of each sheet in each file:

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

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

xlrd_2024-2.0.1.tar.gz (107.0 kB view details)

Uploaded Source

Built Distribution

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

xlrd_2024-2.0.1-py2.py3-none-any.whl (96.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file xlrd_2024-2.0.1.tar.gz.

File metadata

  • Download URL: xlrd_2024-2.0.1.tar.gz
  • Upload date:
  • Size: 107.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for xlrd_2024-2.0.1.tar.gz
Algorithm Hash digest
SHA256 cc297f9064ba0fddfd5732b87589ef02ff1870374f02dd3dd8f93eb4cf98debe
MD5 c32b8d1971cc34a9b4a9d71b7abd43be
BLAKE2b-256 28371428529515fffd4a4aed070b18b76cc70b523198fccf5b143e23f6497d42

See more details on using hashes here.

File details

Details for the file xlrd_2024-2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: xlrd_2024-2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 96.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for xlrd_2024-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a743b29d24fba7395a950722e6324df64adbe5b23cf9c982e3a8570b153dd1ec
MD5 e39f14f8b68e3cebb8f5cf1a2620acc3
BLAKE2b-256 49e053a2e0c432c0c97d868d4f24376dfda51fca41b9b388360bed985af72623

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