agate-excel 0.2.0

Build status PyPI downloads Version License Support Python versions

agate-excel adds read support for Excel files (xls and xlsx) to agate.

Important links:

Install

To install:

pip install agate-excel

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

Importing agate-excel adds methods to agate.Table. Once you’ve imported it, 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

agateexcel.table_xls.from_xls(cls, 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.
agateexcel.table_xlsx.from_xlsx(cls, 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.

Authors

The following individuals have contributed code to agate-excel:

Changelog

0.2.0

  • Fix bug in handling of None in boolean columns for XLS. (#11)
  • Removed usage of deprecated openpyxl method get_sheet_by_name.
  • Remove monkeypatching.
  • Upgrade required agate version to 1.5.0.
  • Ensure columns with numbers for names (e.g. years) are parsed as strings.

0.1.0

  • Initial version.

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.

Indices and tables