|Generated:||August 25, 2015|
Openpyxl is a Python library for reading and writing Excel 2010 xlsx/xlsm/xltx/xltm files.
It was born from lack of existing library to read/write natively from Python the Office Open XML format.
All kudos to the PHPExcel team as openpyxl was initially based on PHPExcel http://www.phpexcel.net/
from openpyxl import Workbook wb = Workbook() # grab the active worksheet ws = wb.active # Data can be assigned directly to cells ws['A1'] = 42 # Rows can also be appended ws.append([1, 2, 3]) # Python types will automatically be converted import datetime ws['A2'] = datetime.datetime.now() # Save the file wb.save("sample.xlsx")
How to Contribute Code¶
Any help will be greatly appreciated, just follow those steps:
1. Please start a new fork (https://bitbucket.org/openpyxl/openpyxl/fork) for each independent feature, don’t try to fix all problems at the same time, it’s easier for those who will review and merge your changes ;-)
2. Hack hack hack
3. Don’t forget to add unit tests for your changes ! (YES, even if it’s a one-liner, or there is a high probability your work will not be taken into consideration). There are plenty of examples in the /test directory if you lack know-how or inspiration.
4. If you added a whole new feature, or just improved something, you can be proud of it, so add yourself to the AUTHORS file :-)
5. Let people know about the shiny thing you just implemented, update the docs !
6. When it’s done, just issue a pull request (click on the large “pull request” button on your repository) and wait for your code to be reviewed, and, if you followed all theses steps, merged into the main repository.
For further information see Development Tools
This is an open-source project, maintained by volunteers on their spare time, so while we try to work on this project as often as possible, sometimes life gets in the way. Please be patient.
Other ways to help¶
There are several ways to contribute, even if you can’t code (or can’t code well):
- triaging bugs on the bug tracker: closing bugs that have already been closed, are not relevant, cannot be reproduced, ...
- updating documentation in virtually every area: many large features have been added (mainly about charts and images at the moment) but without any documentation, it’s pretty hard to do anything with it
- proposing compatibility fixes for different versions of Python: we support 2.6 to 3.4, so if it does not work on your environment, let us know :-)
The best method to install openpyxl is using a PyPi client such as easy_install (setuptools) or pip. It is advisable to do this in a Python virtualenv without system packages:
$ pip install openpyxl
$ easy_install openpyxl
To install from sources (there is nothing to build, openpyxl is 100% pure Python), you can download an archive from bitbucket (look in the “tags” tab).
There is support for the popular lxml library which will be used if it is installed.
After extracting the archive, you can do:
$ python setup.py install
To be able to include images (jpeg,png,bmp,...) into an openpyxl file, you will also need the ‘PIL’ library that can be installed with:
$ pip install pillow
or browse https://pypi.python.org/pypi/Pillow/, pick the latest version and head to the bottom of the page for Windows binaries.
Getting the source¶
Source code is hosted on bitbucket.org. You can get it using a Mercurial client and the following URLs:
- $ hg clone https://bitbucket.org/openpyxl/openpyxl -r 2.2.6
or to get the latest development version:
- $ hg clone https://bitbucket.org/openpyxl/openpyxl
Working with styles¶
Information for Developers¶
- Testing on Windows
- 2.2.6 (unreleased)
- 2.2.5 (2015-06-29)
- 2.2.4 (2015-06-17)
- 2.2.3 (2015-05-26)
- 2.2.2 (2015-04-28)
- 2.2.1 (2015-03-31)
- 2.2.0 (2015-03-11)
- 2.2.0-b1 (2015-02-18)
- 2.1.5 (2015-02-18)
- 2.1.4 (2014-12-16)
- 2.1.3 (2014-12-09)
- 2.1.2 (2014-10-23)
- 2.1.1 (2014-10-08)
- 2.1.0 (2014-09-21)
- 2.0.5 (2014-08-08)
- 2.0.4 (2014-06-25)
- 2.0.3 (2014-05-22)
- 2.0.2 (2014-05-13)
- 2.0.1 (2014-05-13) brown bag
- 2.0.0 (2014-05-13) brown bag
- 1.8.6 (2014-05-05)
- 1.8.5 (2014-03-25)
- 1.8.4 (2014-02-25)
- 1.8.3 (2014-02-09)
- 1.8.2 (2014-01-17)
- 1.8.1 (2014-01-14)
- 1.8.0 (2014-01-08)
- 1.7.0 (2013-10-31)