I just took a look at writing macros for calc.
Seems horrifically difficult.
I was at
http://www.openoffice.org/udk/python/python-bridge.html
and here was supposed to be the best but right at the beginning his cmd lines wouldn’t work for me
http://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html
and I’ve been here
https://help.libreoffice.org/6.3/en-US/text/sbasic/python/python_programming.html?&DbPAR=WRITER&System=WIN
Is that as good as I’ll find or is there some better way?