Home » excel » java – Saving different csv files as different sheets in a single excel workbook

java – Saving different csv files as different sheets in a single excel workbook

Posted by: admin April 23, 2020 Leave a comment

Questions:

Related to this question, how to save many different csv files into one excel workbook with one sheet per csv ? I would like to know how to do this programmatically in Java.

How to&Answers:

You’ll need some form of library for accessing Excel from Java. A Google search turned this one up:

http://j-integra.intrinsyc.com/support/com/doc/excel_example.html

An alternative is to use the XML Excel format that came into being with Office 2003. You’ll end up with a XML file, but you can open it in Excel and see the different sheets.

http://www.javaworld.com/javaworld/jw-07-2004/jw-0712-officeml.html

Answer:

If you want open source, the POI library can be used to generated Excel files.

A nice CSV parser is Open CSV

That should set the stage for what you are trying to do (basically use the CSV parser to get data, then write the data to an XLS file.

Answer:

Take a look at the Aspose products, I’ve used them before when working with Excel and they saved me a huge amount of headache and time. Excel has several quirks that can make importing and exporting spreadsheets painful.

Aspose.Cells