|
| 1 | +xlrd |
| 2 | +==== |
| 3 | + |
| 4 | +|Build Status|_ |Coverage Status|_ |Documentation|_ |PyPI version|_ |
| 5 | + |
| 6 | +.. |Build Status| image:: https://circleci.com/gh/python-excel/xlrd/tree/master.svg?style=shield |
| 7 | +.. _Build Status: https://circleci.com/gh/python-excel/xlrd/tree/master |
| 8 | + |
| 9 | +.. |Coverage Status| image:: https://codecov.io/gh/python-excel/xlrd/branch/master/graph/badge.svg?token=lNSqwBBbvk |
| 10 | +.. _Coverage Status: https://codecov.io/gh/python-excel/xlrd |
| 11 | + |
| 12 | +.. |Documentation| image:: https://readthedocs.org/projects/xlrd/badge/?version=latest |
| 13 | +.. _Documentation: http://xlrd.readthedocs.io/en/latest/?badge=latest |
| 14 | + |
| 15 | +.. |PyPI version| image:: https://badge.fury.io/py/xlrd.svg |
| 16 | +.. _PyPI version: https://badge.fury.io/py/xlrd |
| 17 | + |
| 18 | + |
| 19 | +xlrd is a library for reading data and formatting information from Excel |
| 20 | +files in the historical ``.xls`` format. |
| 21 | + |
| 22 | +.. warning:: |
| 23 | + |
| 24 | + This library will no longer read anything other than ``.xls`` files. For |
| 25 | + alternatives that read newer file formats, please see http://www.python-excel.org/. |
| 26 | + |
| 27 | +The following are also not supported but will safely and reliably be ignored: |
| 28 | + |
| 29 | +* Charts, Macros, Pictures, any other embedded object, **including** embedded worksheets. |
| 30 | +* VBA modules |
| 31 | +* Formulas, but results of formula calculations are extracted. |
| 32 | +* Comments |
| 33 | +* Hyperlinks |
| 34 | +* Autofilters, advanced filters, pivot tables, conditional formatting, data validation |
| 35 | + |
| 36 | +Password-protected files are not supported and cannot be read by this library. |
| 37 | + |
| 38 | +Quick start: |
| 39 | + |
| 40 | +.. code-block:: python |
| 41 | +
|
| 42 | + import xlrd |
| 43 | + book = xlrd.open_workbook("myfile.xls") |
| 44 | + print("The number of worksheets is {0}".format(book.nsheets)) |
| 45 | + print("Worksheet name(s): {0}".format(book.sheet_names())) |
| 46 | + sh = book.sheet_by_index(0) |
| 47 | + print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols)) |
| 48 | + print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3))) |
| 49 | + for rx in range(sh.nrows): |
| 50 | + print(sh.row(rx)) |
| 51 | +
|
| 52 | +From the command line, this will show the first, second and last rows of each sheet in each file: |
| 53 | + |
| 54 | +.. code-block:: bash |
| 55 | +
|
| 56 | + python PYDIR/scripts/runxlrd.py 3rows *blah*.xls |
0 commit comments