I want to write a background script that modify a Calc spreadsheet - in Python. It needs to maintain a state between invocations. But what I find out I cannot do that with a macro (LibreOffice macros launches a new Python environment each time -i.e. no state). (Explainer: I need to map between external ID and the row number in Calc).
In particular I looked at ScriptForge calc functions - providing the API for Calc.
Is there any way to have a long running Python script that runs in the background inside LibreOffice ?
If not, how could I cache my data (inside the LibreOffice process) - to have a quick key/value lookup from Python ? (basically a large key/value table, string => int)
Since there could come big chunks of data I’d really like this in-process way of manipulating the spreadsheet - as opposed to external TCP/socket alternative.
Thanks for pointers.