If by "libre" you mean LibreOffice, you can start with learning its API:
http://api.libreoffice.org[
^].
But what you do sounds line an absolute low-tech, a view of a user, not software development, who tends to think that programming is something like advanced user behavior. You may waste a lot less effort and obtain more reusable and useful results if you leave the idea of "automating" office and do all your calculations from scratch. However, I cannot be 100% sure, because I don't know all your goals. I would just advise your to think about it.
—SA