|
| 1 | +<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
| 2 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | +<head> |
| 4 | +<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' /> |
| 5 | +<title>The xlrd Module -- README</title> |
| 6 | +</head> |
| 7 | +<body> |
| 8 | + |
| 9 | +<h3>Python package "xlrd"</h3> |
| 10 | + |
| 11 | +<p><b>Purpose</b>: Provide a library for developers to use to extract data |
| 12 | + from Microsoft Excel (tm) spreadsheet files. |
| 13 | + It is not an end-user tool. |
| 14 | +</p> |
| 15 | +<p><b>Author </b>: John Machin, Lingfo Pty Ltd ( [email protected]) |
| 16 | +</p> |
| 17 | +<p><b>Licence</b>: BSD-style (see licences.py) |
| 18 | +</p> |
| 19 | +<p><b>Version of xlrd</b>: 0.7.1 -- 2009-05-31 |
| 20 | +</p> |
| 21 | +<p><b>Versions of Python supported</b>: 2.6-2.7. |
| 22 | +</p> |
| 23 | +<p><b>External modules required</b>: |
| 24 | +</p> |
| 25 | +<dl><dd> The package itself is pure Python with no dependencies on modules or packages |
| 26 | + outside the standard Python distribution. |
| 27 | +</dd> |
| 28 | +</dl> |
| 29 | +<p><b>Versions of Excel supported</b>: |
| 30 | + 2004, 2003, XP, 2000, 97, 95, 5.0, 4.0, 3.0, 2.1, 2.0. |
| 31 | + Support for Excel 2007 .xlsx files scheduled for version 0.7.1. |
| 32 | +</p> |
| 33 | +<p><b>Outside the current scope</b>: xlrd will safely and reliably ignore any of these |
| 34 | +if present in the file: |
| 35 | +</p> |
| 36 | +<ul> |
| 37 | +<li> Charts, Macros, Pictures, any other embedded object. WARNING: currently |
| 38 | + this includes embedded worksheets. |
| 39 | +</li> |
| 40 | +<li> VBA modules |
| 41 | +</li> |
| 42 | +<li> Formulas (results of formula calculations are extracted, of course). |
| 43 | +</li> |
| 44 | +<li> Comments |
| 45 | +</li> |
| 46 | +<li> Hyperlinks |
| 47 | +</li> |
| 48 | +<li> Autofilters, advanced filters, pivot tables, conditional formatting, data validation |
| 49 | +</li> |
| 50 | +</ul> |
| 51 | +<p><b>Unlikely to be done</b>: |
| 52 | +</p> |
| 53 | +<ul><li> Handling password-protected (encrypted) files. |
| 54 | +</li> |
| 55 | +</ul> |
| 56 | +<p><b>Particular emphasis (refer docs for details)</b>: |
| 57 | +</p> |
| 58 | +<ul><li> Operability across OS, regions, platforms |
| 59 | +</li> |
| 60 | +<li> Handling Excel's date problems, including the Windows / Macintosh |
| 61 | + four-year differential. |
| 62 | +</li> |
| 63 | +<li> Providing access to named constants and named groups of cells (from version 0.6.0) |
| 64 | +</li> |
| 65 | +<li> Providing access to "visual" information: font, "number format", background, border, |
| 66 | + alignment and protection for cells, height/width etc for rows/columns (from version 0.6.1) |
| 67 | +</li> |
| 68 | +</ul> |
| 69 | +<p><b>Quick start</b>: |
| 70 | +</p> |
| 71 | +<pre><code> import xlrd |
| 72 | + book = xlrd.open_workbook("myfile.xls") |
| 73 | + print "The number of worksheets is", book.nsheets |
| 74 | + print "Worksheet name(s):", book.sheet_names() |
| 75 | + sh = book.sheet_by_index(0) |
| 76 | + print sh.name, sh.nrows, sh.ncols |
| 77 | + print "Cell D30 is", sh.cell_value(rowx=29, colx=3) |
| 78 | + for rx in range(sh.nrows): |
| 79 | + print sh.row(rx) |
| 80 | + # Refer to docs for more details. |
| 81 | + # Feedback on API is welcomed. |
| 82 | +</code></pre><p> |
| 83 | +</p> |
| 84 | +<p><b>Another quick start</b>: This will show the first, second and last rows of each |
| 85 | + sheet in each file: |
| 86 | +</p> |
| 87 | + |
| 88 | +<pre><code> OS-prompt>python PYDIR/scripts/runxlrd.py 3rows *blah*.xls</code></pre> |
| 89 | + |
| 90 | +<p><b>Installation</b>: |
| 91 | +</p> |
| 92 | +<ul><li> On Windows: use the installer. |
| 93 | +</li> |
| 94 | +<li> Any OS: Unzip the .zip file into a suitable directory, |
| 95 | + chdir to that directory, then do "python setup.py install". |
| 96 | +</li> |
| 97 | +<li> If PYDIR is your Python installation directory: |
| 98 | + the main files are in PYDIR/Lib/site-packages/xlrd |
| 99 | + the docs are in the doc subdirectory, |
| 100 | + and there's a sample script: PYDIR/Scripts/runxlrd.py |
| 101 | +</li> |
| 102 | +<li> If os.sep != "/": make the appropriate adjustments. |
| 103 | +</li> |
| 104 | +</ul> |
| 105 | +<p><b>Download URLs</b>: |
| 106 | +</p> |
| 107 | +<ul><li> http://pypi.python.org/pypi/xlrd |
| 108 | +</li> |
| 109 | +<li> http://www.lexicon.net/sjmachin/xlrd.htm |
| 110 | +</li> |
| 111 | +</ul> |
| 112 | +<p><b>Acknowledgements</b>: |
| 113 | +</p> |
| 114 | +<ul><li> This package started life as a translation from C into Python |
| 115 | +of parts of a utility called "xlreader" developed by David Giffin. |
| 116 | +"This product includes software developed by David Giffin < [email protected]>." |
| 117 | +</li> |
| 118 | +<li> OpenOffice.org has truly excellent documentation of the Microsoft Excel file formats |
| 119 | +and Compound Document file format, authored by Daniel Rentz. See http://sc.openoffice.org |
| 120 | +</li> |
| 121 | +<li> U+5F20 U+654F: over a decade of inspiration, support, and interesting decoding opportunities. |
| 122 | +</li> |
| 123 | +<li> Ksenia Marasanova: sample Macintosh and non-Latin1 files, alpha testing |
| 124 | +</li> |
| 125 | +<li> Backporting to Python 2.1 was partially funded by Journyx - provider of |
| 126 | +timesheet and project accounting solutions (http://journyx.com/). |
| 127 | +</li> |
| 128 | +<li> Provision of formatting information in version 0.6.1 was funded by Simplistix Ltd |
| 129 | + (http://www.simplistix.co.uk/) |
| 130 | +</li> |
| 131 | +<li> << a growing list of names; see HISTORY.html >>: feedback, testing, test files, ... |
| 132 | +</li></ul> |
| 133 | + |
| 134 | +</body> |
| 135 | +</html> |
0 commit comments