What is the best way to write an excel file from Java?

2.3k views Asked by At

What library would you guys recommend to write an excel file from Java? It has to be pure Java solution, so it will work on any platform.

Thanks, Grae

EDIT: It can't be CSV file format. It has to have column headers, data format type, etc.

2

There are 2 answers

1
Jason LeBrun On BEST ANSWER

The best solution I've found for generating Microsoft document formats is the Apache POI library: http://poi.apache.org/

0
mateusza On

Starting with MS Office 2007 Excel files are saved in Office Open XML (.xlsx) by default. Create such file with any content, rename it to .zip and look inside. It's a bunch of folders and XML files compressed together.

Java provides support for creating zip files using java.util.zip. And that's all you need.