Hello everybody.
Is there a python library or package to manipulate data in LivreOffice Calc? A substitution of openpyxl of panda for office excel?
Best regards,
marcin
Hello everybody.
Is there a python library or package to manipulate data in LivreOffice Calc? A substitution of openpyxl of panda for office excel?
Best regards,
marcin
Hello
read|write .ods-files without a running Libreoffice-Instance? →search for “ods” on pypi-package-index it seems pyexcel-ods3 or pandas-ods-reader looks straight-forward!
Personally I prefer to work interactive and with a running Libreoffice-instance … as already written interactive from jupyter notebook Session →→ the initial setup in notebook:
# in the first notbook-cell this is for running LO-calc
from subprocess import Popen
from random import sample
from string import ascii_letters as abc
PIPENAME = ''.join(sample(abc,8))
officepath = 'soffice'
calc = '--calc'
pipe = f"--accept=pipe,name={PIPENAME};urp;StarOffice.ComponentContext"
Popen([officepath,
calc,
pipe]); PIPENAME
#here the second cell for conecting to LO
import uno
from pythonscript import ScriptContext
local = uno.getComponentContext()
resolver = local.ServiceManager.createInstance("com.sun.star.bridge.UnoUrlResolver")
client = resolver.resolve( "uno:pipe,"
f"name={PIPENAME};"
"urp;"
"StarOffice.ComponentContext")
createUnoService = client.ServiceManager.createInstance
XSCRIPTCONTEXT = ScriptContext(client, None, None)