ekhagen.python.pythonoffice
about | graphics | software

PythonOffice

Overview

PythonOffice provides basic support for creation and modification of MS Excel XML Spreadsheets. This is an early release and is still far from a complete interface to the MS Spreadsheet standard, but it do provide support for reading/modifying cell data of different data types. Much emfaces has bin put into allow interaction with excel documents in a pythonic way. Excel sheets are represented as a list of rows, and rows is a list of cells, accordinly these objects works similar to a standard python list object. Cell data are converted to the proper class, ex a cell formated as date will return a datetime python object, if you set a int to any cell the cell data type will be changed to Number, and so on.

Since pytonOffice is built in a modular way, as any good python software, it's easy to modify and extend. You are also welcome to contact me with questions and proposals for new features.

Usage

Unfortunately, there is not yet a sufficient documentation, but here is a hint on how things works.

>>> book = ExcelBook.fromFile('example.xlxml') >>> sheet = book.sheets['Blad1'] >>> for pos,row in sheet.iteritems(): print pos,row 2 ['Example document for the pytonOffice Python module'] 5 ['Text ', 'on', 'row', '5'] 10 ['This is cell E10'] >>> print book.getCell('Blad1!E10') 'This is cell E10' >>> sheet[5].cells.append(book.createCell('One more cell')) >>> print sheet[5] ['Text ', 'on', 'row', '5', 'One more cell'] >>> book.save() _

You should also have a look on excelTest.py in the test folder, there you will find some more hints on how pytonOffice work.

Download

PythonOffice is hosted by SourceForge (http://sourceforge.net/projects/pythonoffice/).

Release: 0.3.0, 2006-10-29 Download PythonOffice

Requirements

Author

Erik Billing, Ekhagen Electronic (www.ekhagen.org)

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

View the full license.

Version history

0.2.1 - 2005-08-16

0.2.2

0.3.0

0.3.1

Comming features