Which library should I use to write an XLS from Linux / Python?

I'd love a good native Python library to write XLS, but it doesn't seem to exist. Happily, Jython does.

So I'm trying to decide between jexcelapi and Apache HSSF: http://www.andykhan.com/jexcelapi/tutorial.html#writing http://poi.apache.org/hssf/quick-guide.html

(I can't use COM automation because I'm not on Windows, and even if I was, I couldn't afford Office licenses.)

My initial thoughts are that POI/HSSF is very thorough, but also very Java-- everything seems a bit harder than it needs to be. Good documentation, but my head hurts trying to bridge the gap between what it describes and what I need to accomplish.

jexcepapi seems to have a simpler, nicer (for me) interface, but doesn't have very good documentation or community.

Which would you use, and why?


Asked by: Thomas163 | Posted: 28-01-2022






Answer 1

What's wrong with xlwt?

Answered by: Carlos955 | Posted: 01-03-2022



Answer 2

+1 for xlwt. See Matt Harrison's blog for posts on how to use xlwt and how to deal with large spreadsheets. Also, check out the python-excel group on Google "If you use Python to read, write or otherwise manipulate Excel files".

Answered by: Thomas890 | Posted: 01-03-2022



Answer 3

I'd use JExcelApi, but only because I've used it before. Never have touched HSSF. Biggest show-stopper I can recall is JExcelApi doesn't support multiple formats in one cell (e.g. half the text in bold, the other half in italic or something like that). I think in general JExcelApi is more limited than HSSF, but the limitations never got in my way.

And yes, documentation is sparse for the interface (and nonexistent for the underlying mechanisms), but I thought it was doable...

Answered by: Chelsea425 | Posted: 01-03-2022



Answer 4

i personally dis-advise JExcel if you intent to use anything more then very simple text to excel and vice versa.

the more advanced features are abstracted very leaky from the underlying (basically undocumented) low-level code / (documented) Excel specs.

another problem we ran into is jexcel fails fatally when encountering invalid formulas. and if you need to parse client supplied spreadsheets this is a problem.

also the new POI version support (almost) seemless both xls and xlsx at the same time.

Answered by: Maddie144 | Posted: 01-03-2022



Answer 5

Excel exposes the same OLE automation API used by VBA to anything that supports COM. You can use win32com (which is included with ActiveState Python by default) to manipulate spreadsheets in much the same way that you would do in VBA.

Answered by: Marcus312 | Posted: 01-03-2022



Similar questions

Using a java library from python

I have a python app and java app. The python app generates input for the java app and invokes it on the command line. I'm sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java. Any pointers? (FYI I'm v. new to Python) Clarification (at the cost of a long question: apologies) The py app (which I don't own) takes user input in the form of...


Use a Ruby or Python library in Java

I wonder if it is possible to use a Ruby gem in Java with JRuby. I found a lot of information on how to use Java classes in Ruby (with JRuby), but not for the other way around. What are the steps to use a Ruby library like Asciidoctor in Java? Would it be also possible to use all Python libraries in Java with Jython li...


java - Can I call Python library using JNI?

I know there is jython solution, but jython can not load wtxl and rdxl; it can only load limited pip libraries. So I want to write JNI to do it. The main procedure is as follows: Java <-> JNI <-> C/C++ Python Interface <-> Local Python environment <-> my html2excel python libraries The problem is that it fails to import the html2excel library. I use C/C++ code as this:


java - What is the best library in python to deal with excel files?

Closed. This question does not meet Stack Overflow guid...


A good Java library for network math

Closed. This question does not meet Stack Overflow guid...


How to browse for a file in java swing library?

I was wondering if there was some kind of J tool in the java swing library that opens up a file browser window and allows a user to choose a file. Then the ouput of the file would be the absolute path of the chosen file. Thanks in advance,


nlp - Fuzzy string search library in Java

Closed. This question does not meet Stack Overflow guid...


What is the best Java OXM library?

Even though I've been a developer for awhile I've been lucky enough to have avoided doing much work with XML. So now I've got a project where I've got to interact with some web services, and would like to use some kind of Object-to-XML Mapping solution. The only one I'm aware of is JAXB. Is that the best to go with? Are there any other recommendations? One catch - I'm stuck using Java 1.4, so I can't do an...


Java Chart library for OLAP

Closed. This question does not meet Stack Overflow guid...


Using a java library from python

I have a python app and java app. The python app generates input for the java app and invokes it on the command line. I'm sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java. Any pointers? (FYI I'm v. new to Python) Clarification (at the cost of a long question: apologies) The py app (which I don't own) takes user input in the form of...


Is there a Java library to access the native Windows API?

Is there a Java library to access the native Windows API? Either with COM or JNI.


PDF to text tool or Java library?


java - How Can I Add the Apache POI Library in and Eclipse Project?

I download the Apache POI from apache.org but don't know how use it with one of my existing project in Eclipse.


Do you know of a Java library to access the native linux api?

Do you know of a Java library to access the native linux api? I guess something like this must use JNI. So be it.






Still can't find your answer? Check out these amazing Java communities for help...



Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)



top