Working with MS Excel files from Python

The xlwt Module (https://pypi.python.org/pypi/xlwt) - a Python package for generating Microsoft Excel™ spreadsheet files. I have found this module very useful for rapid development.
The documentation is currently incomplete, but the package contains a comprehensive set of examples, so you'll most likely start using the module in just 5 minutes.
xlwt is a library for generating spreadsheet files that are compatible with Excel 97/2000/XP/2003, OpenOffice.org Calc, and Gnumeric. xlwt has full support for Unicode. Excel spreadsheets can be generated on any platform without needing Excel or a COM server. The only requirement is Python 2.3 to 2.7.
The installation is easy. Just unzip the .zip file into a suitable directory, chdir to that directory, then do "python setup.py install".

Caveats:
The only error I've got is UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) when trying to write 'str' data with cyrillic characters in it. So make sure to convert the string to unicode before using sheet.write() method. One of the ways to do it is to use unicode(line, coding) method.

Comments

Popular posts from this blog

How to uninstall a broken software

Xerox 116-324 fault when printing .doc or .pdf containing callibri fonts

Create Outlook calendar item with Python