FYI: getting data from an OpenOffice.org spreadsheet

John Machin sjmachin at lexicon.net
Sun Sep 3 18:21:28 EDT 2006


Sybren Stuvel wrote:
> Hi folks,
>
> Sometimes I have to feed data from an OpenOffice.org spreadsheet into
> some Python program. To make that really easy, I've written a small
> example program that connects to a running OpenOffice.org instance and
> reads the data from the currently opened spreadsheet.
>
> Check out http://www.stuvel.eu/archive/28/ to see the source and
> requirements. It took a lot of digging in the rather complex OOo API
> documentation, but the end result is just as I like it: clean and
> simple. I hope this helps people out!
>

Suppose one has over a hundred spreadsheets (real-life example: budgets
from an organisation's reporting centres) ... manually opening each in
OOo Calc is less than appealing, and not very robust.

With the 2nd example (alf's question: copy OOo Calc file to Excel xls
file), I don't see any advantage at all over the manual procedure (1)
start OOo Calc (2) open Calc file (3) File > Save As > select Microsoft
Excel 97 etc format > ... what am I missing? Your solution requires (1)
edit script to change name of output file; save script (where?) (2)
start OOo Calc with magic-spell on the command line (3) open calc file
(4) run script.

How does one write a script that can be in control e.g. script starts
OOo (if necessary), and extracts some data from all spreadsheet files
in a given directory (while one is at lunch)? 

Cheers,
John




More information about the Python-list mailing list