pyexcel - Let you focus on data, instead of file formats

Author:C.W.
Source code:http://github.com/pyexcel/pyexcel
Issues:http://github.com/pyexcel/pyexcel/issues
License:New BSD License
Version:0.2.5
Generated:September 01, 2016

Introduction

pyexcel provides one application programming interface to read, manipulate and write data in different excel formats. This library makes information processing involving excel files an enjoyable task. The data in excel files can be turned into array or dict with least code, vice versa. And ready-made custom filters and formatters can be applied. This library focuses on data processing using excel files as storage media hence fonts, colors and charts were not and will not be considered.

Excel files are de-facto file format for information sharing in non-software centric organisations. Excel files are not only used for mathematical computation in financial institutions but also used for many other purposes in an office work environment. This is largely casued by wide adoption of Microsoft Office. Comparing the existing, mathematics savvy Pandas library, this library intends to help data processing job where data extraction is more important than data analysis. In such context, ease of use, and low overhead is preferred, while Pandas is as big as 4MB and contains hundreds of potentially useful functions.

Note

Since version 0.2.2, no longer a plugin should be explicitly imported. They are imported if they are installed. Please use pip to manage the plugins.

Getting the source

Source code is hosted in github. You can get it using git client:

$ git clone http://github.com/pyexcel/pyexcel.git

Installation

You can install it via pip:

$ pip install pyexcel

or clone it and install it:

$ git clone http://github.com/pyexcel/pyexcel.git
$ cd pyexcel
$ python setup.py install

For individual excel file formats, please install them as you wish:

a map of plugins and supported excel file formats
Plugin Supported file formats Dependencies Python versions Comments
pyexcel csv, csvz [1], tsv, tsvz [2] pyexcel-io 2.6, 2.7, 3.3, 3.4, 3.5, pypy  
xls xls, xlsx(read only), xlsm(read only) xlrd, xlwt 2.6, 2.7, 3.3, 3.4, 3.5, pypy supports reading xlsx as well
xlsx xlsx openpyxl 2.6, 2.7, 3.3, 3.4, 3.5, pypy  
ods3 ods ezodf, lxml 2.6, 2.7, 3.3, 3.4, 3.5,  
ods ods (python 2.6, 2.7) odfpy 2.6, 2.7  
text json, rst, mediawiki, latex, grid, etc. tabulate 2.6, 2.7, 3.3, 3.4, 3.5, pypy writing to files only
Plugin compatibility table
pyexcel pyexcel-io xls xlsx ods ods3 text
0.2.2+ 0.2.0 0.2.0 0.2.0 0.2.0 0.2.0 0.2.1+
0.2.1 0.1.0 0.1.0 0.1.0 0.1.0+ 0.1.0+ 0.2.0
0.2.0 0.1.0 0.1.0 0.1.0 0.1.0+ 0.1.0+ 0.1.0+

Usage

Suppose you want to process the following excel data :

Name Age
Adam 28
Beatrice 29
Ceri 30
Dean 26

Here are the example usages:

>>> import pyexcel as pe
>>> records = pe.get_records(file_name="your_file.xls")
>>> for record in records:
...     print("%s is aged at %d" % (record['Name'], record['Age']))
Adam is aged at 28
Beatrice is aged at 29
Ceri is aged at 30
Dean is aged at 26

Tutorial

Real world cases

Indices and tables

Footnotes

[1]zipped csv file
[2]zipped tsv file