agate-excel 0.1.0¶

agate-excel adds read support for Excel files (xls and xlsx) to agate.
Important links:
- agate http://agate.rtfd.org
- Documentation: http://agate-excel.rtfd.org
- Repository: https://github.com/onyxfish/agate-excel
- Issues: https://github.com/onyxfish/agate-excel/issues
Install¶
To install:
pip install agateexcel
For details on development or supported platforms see the agate documentation.
Usage¶
agate-excel uses a monkey patching pattern to add read for xls and xlsx files support to all agate.Table
instances.
import agate
import agateexcel
agateexcel.patch()
Calling patch()
attaches all the methods of TableXLS
and TableXLSX
to agate.Table
. Once you’ve patched the module, you can create tables from both XLS and XLSX files.
table = agate.Table.from_xls('examples/test.xls')
print(table)
table = agate.Table.from_xlsx('examples/test.xlsx')
print(table)
Both methods accept a sheet
argument to specify which sheet to create the table from.
API¶
-
class
agateexcel.table_xls.
TableXLS
¶ -
classmethod
from_xls
(path, sheet=None)¶ Parse an XLS file.
Parameters: - path – Path to an XLS file to load or a file-like object for one.
- sheet – The name of a worksheet to load. If not specified then the first sheet will be used.
-
classmethod
-
class
agateexcel.table_xlsx.
TableXLSX
¶ -
classmethod
from_xlsx
(path, sheet=None)¶ Parse an XLSX file.
Parameters: - path – Path to an XLSX file to load or a file or file-like object for one.
- sheet – The name or integer index of a worksheet to load. If not specified then the “active” sheet will be used.
-
classmethod
License¶
The MIT License
Copyright (c) 2015 Christopher Groskopf and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.