2

I've managed to access LibreOffice.calc, open my file, select my sheet and getValue() and getFormula()... That is, my job is (nearly) done, but... the PyUno bridge is just a bridge and not very Pythonic.

For instance, for sheet in sheets: throws the following exception: TypeError: 'pyuno' object is not iterable

So, the question is if somebody, somewhere, has an Open Source Pythonic library to the LibreOffice (calc) object model?

off = LibreOffice()
calc = off.Open(file)
sheets = calc.getSheets()
for sheet in sheets:
    print(sheet.name)
    rng = sheet.Range("A1:C5")
...
GUI Junkie
  • 539
  • 1
  • 17
  • 31

2 Answers2

1

Here is what you should have done instead:

sheets = calc.getSheets()
sheet_names = sheets.getElementNames()

for sheet_name in sheet_names:
    print(sheet_name)
    sheet = sheets.getByName(sheet_name)

Code doesen't lie :D

Bwire
  • 1,181
  • 1
  • 14
  • 25
0

There is not such a thing, yet. I have been experimenting with such a thing myself here are work, not clear if it will ever be released. My approach was to take the doxygen output and use that as input to a code generator to create a set of wrapper classes, these could then be even implemented in python for test frames.

user2646177
  • 175
  • 1
  • 1
  • 7