python-excel

xlrd: Read Data from Legacy Excel Files

xlrd is a Python library for reading cell data and formatting from legacy Excel .xls files. It suits scripts and applications that need to inspect older spreadsheets, but it does not read newer Excel formats such as .xlsx.

Stars
2.2k
Forks
435
Stars, last 16 days
+0

Our take

Health score

40/100

How it is scored
Activity
31
Community
64
Issues
21
Pull requests
44

+0 stars in the last 16 days

Overview

xlrd reads data and formatting information from Excel files in the historical .xls format. It gives Python scripts and applications a way to inspect worksheets, their dimensions, and cell values without manually opening spreadsheets.

Use it when your input files are .xls and you need read access to their tabular contents. It no longer supports newer Excel formats, so check the project documentation for format details before choosing it.

Key Features

  • Opens .xls workbooks from Python.
  • Lists worksheet names and reports the number of sheets.
  • Reads worksheets by index or name.
  • Provides worksheet row and column counts.
  • Retrieves individual cell values and rows.
  • Extracts results of formula calculations, but not the formulas themselves.
  • Reads cell formatting information.
  • Includes a command-line script for displaying selected rows from .xls files.

Use Cases

  • A data analyst can inspect legacy .xls spreadsheets as part of a Python data-processing workflow.
  • A developer can build a utility that extracts cell values from older Excel files.
  • A team maintaining a system with archived .xls exports can read worksheet contents without converting each file by hand.
  • A user can quickly check worksheet names, dimensions, and sample rows from the command line.

Getting Started

Install the package:

pip install xlrd

See the README for usage examples and command-line details.

Considerations

  • The library reads .xls files only. It does not read .xlsx files.
  • Password-protected files are not supported.
  • Charts, macros, pictures, embedded objects, VBA modules, comments, hyperlinks, filters, pivot tables, conditional formatting, and data validation are not supported. Some are ignored when reading.
  • Formula text is not available, although calculated results are extracted.

Found this useful?

Share it with someone who would like xlrd.