Library for developers to extract data from Microsoft Excel (tm) .xls spreadsheet files
Project Links
Meta
Author: Chris Withers
Requires Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
License
- OSI Approved :: BSD License
Programming Language
- Python
- Python :: 2
- Python :: 2.7
- Python :: 3
- Python :: 3.6
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
Operating System
- OS Independent
Topic
- Database
- Office/Business
- Software Development :: Libraries :: Python Modules
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:
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
Dec 11, 2020
2.0.1
Dec 11, 2020
2.0.0
Dec 15, 2018
1.2.0
Aug 22, 2017
1.1.0
Jun 03, 2016
1.0.0
Jul 15, 2015
0.9.4
Apr 09, 2014
0.9.3
Apr 09, 2013
0.9.2
Apr 05, 2013
0.9.1
Jan 31, 2013
0.9.0
Aug 01, 2012
0.8.0
Jun 21, 2012
0.7.9
Jun 07, 2012
0.7.8
Apr 13, 2012
0.7.7
Apr 04, 2012
0.7.6
Apr 03, 2012
0.7.5
Apr 03, 2012
0.7.4
Feb 28, 2012
0.7.3
Feb 21, 2012
0.7.2
Jun 01, 2009
0.7.1
Mar 11, 2009
0.7.0
Jun 11, 2007
0.6.1
Feb 25, 2007
0.6.1a4
Mar 17, 2006
0.5.2
Mar 17, 2006
0.0rc0