When I had to do this some years ago I created a macro in OOCalc and called the macro in the document from the command line. Office didn't even have to start in the GUI. After that I used awk to retrieve the values.
Here is a list with threads describing this process:
http://www.oooforum.org/forum/viewtopic.phtml?t=12922
If you read a few of these threads you'll understand what the principle is, choose the simplest one for your needs.
I hope that in the mean time better methods have come up. OOBasic is incomprehensible, error-prone, zero debug possibilities stops working from one version to the next. That is the reason why I cannot point you to a working method, because I don't remember which ones worked and which were broken.
jlinkels