Main Content

Using Python with OpenOffice

Archive - Originally posted on "The Horse's Mouth" - 2009-04-09 17:20:20 - Graham Ellis

The Python-UNO bridge can be used to call up pieces of Python code from within OpenOffice. The source code of a "hello world" example can be found at http://wiki.services.openoffice.org/wiki/PyUNO_bridge, showing you how to start OpenOffice looking for a connection on a TCP/IP port, and then how to run a Python program to pass data - in this case the text "hello world" - into it.

There are also some recent articles (Feb 2009) on Linux Journal - start at http://www.linuxjournal.com/content/python-pyuno-hello-world-addon-openoffice which includes an example, and links to other articles which cover the conversion of spreadsheets to csv files ( http://www.linuxjournal.com/node/1007797 )

If all this is more than you need, there's nothing to stop you importing / exporting data to / from OpenOffice in a file format like CSV .. using files that happen to have been written / read by / from Python.