Python package "xlrd"

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, Lingfo Pty Ltd (

Licence: BSD-style (see

Version of xlrd: 0.7.1 -- 2009-05-31

Versions of Python supported: 2.1 to 2.6.

External modules required:

The package itself is pure Python with no dependencies on modules or packages outside the standard Python distribution.
To run the demo script with Python 2.2 or 2.1 requires the Optik module (version 1.4.1 or later) from

Versions of Excel supported: 2004, 2003, XP, 2000, 97, 95, 5.0, 4.0, 3.0, 2.1, 2.0. Support for Excel 2007 .xlsx files scheduled for version 0.7.1.

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

Unlikely to be done:

Particular emphasis (refer docs for details):

Quick start:

    import xlrd
    book = xlrd.open_workbook("myfile.xls")
    print "The number of worksheets is", book.nsheets
    print "Worksheet name(s):", book.sheet_names()
    sh = book.sheet_by_index(0)
    print, sh.nrows, sh.ncols
    print "Cell D30 is", sh.cell_value(rowx=29, colx=3)
    for rx in range(sh.nrows):
        print sh.row(rx)
    # Refer to docs for more details.
    # Feedback on API is welcomed.

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

    OS-prompt>python PYDIR/scripts/ 3rows *blah*.xls


Download URLs: