Parthiban
Parthiban

Reputation: 105

Convert excel file from XLSX to XLSB in Java

I am using Java + Apache POI to generate an excel file (format xlsx/xls). Due to huge data the generated excel file (format xlsx/xls) takes more size (~50 MB).

So I am trying to convert xlsx/xls to xlsb to reduce the size of the excel file.

Here is the problem: Apache POI does not support writing to xlsb file. So what I am trying is:

  1. Generate a xlsx/xls file using Apache POI.
  2. After that convert generated xlsx/xls to xlsb. For this I am using SmartXls Java library. But this library is not open source. You need to buy license for this. Also I checked EasyXls Java library, but it also requires buying a license.

Below code is used to convert xlsx/xls to xlsb using SmartXls Java library:

WorkBook wb = new WorkBook();
wb.readXLSX(.../xlsxPath);
wb.writeXLSB(new java.io.FileOutputStream(.../xlsbPath));
wb.dispose();

Kindly someone help me whether any open source library is available for it or is there any other way to do this conversion in Java.

Thanks in advance.

Upvotes: 1

Views: 2488

Answers (0)

Related Questions