Z
Z
Zaharov2011-08-15 09:29:08
linux
Zaharov, 2011-08-15 09:29:08

Working with excel files in python on linux

The general task is as follows: it is necessary to write something like a template system for Excel files, i.e. at the input there is a file in which places for inserting data are marked with marks, and at the output a file generated according to this template with the necessary data is given.

xlutils, unfortunately, is not suitable, because kills all the design clean. In theory, you can use win32com to work directly through Excel, but it stops you that you really don’t want to mess with Windows.
The final idea was to use OpenOffice, like there is a Python Uno Bridge and Danny's OpenOffice.org library. But the fact is that I would like to use LibreOffice and it is not clear how much LO is written for OO.

The final questions are: are there any simpler solutions to the problem than using uno? And is it possible to use LibreOffice instead of OpenOffice?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mjr27, 2011-08-16
@Zaharov

Working options 4:
1) uno. slow (very! on my benchmarks, processing ~ 10-20 cells / second was obtained), sadly, the OO must be run on the same machine as the script. pluses - actually 100th guarantee
2) xslx - as already mentioned, a very simple format, parsed "by hand".
3) xlutils - it’s strange that it killed the design, to be honest, xlutils.copy solved my similar tasks 100% (not without a file, yes).
4) (editor's choice) to form xlsx, then through OO, if necessary, convert to xls. 2-3 seconds per file

O
Oleg Matrozov, 2011-08-15
@Mear

Hmm... what output file format do you need? xls or xlsx? It's just that in the second case it's probably faster and easier to assemble it with handles from the finished xlsx by unpacking and editing the xml directly.
Although even if you need xls, then xlsx obtained in this way can be quickly converted to xls or something else using command-line utilities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question