Spire.XLS for Java library is capable of reading XLS/XLSX files and saving them as CSV. You just need to write 4 lines of code.
Maven dependencies:
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls</artifactId>
<version>5.3.3</version>
</dependency>
</dependencies>
Save a worksheet of an XLS/XLSX file as CSV:
import com.spire.xls.*;
import java.nio.charset.Charset;
public class ExcelToCSV {
public static void main(String[] args) {
//Create a workbook
Workbook workbook = new Workbook();
//Load an xlsx or xls file
workbook.loadFromFile("C:\\Users\\Test1\\Desktop\\sample.xlsx");
//Get the first sheet
Worksheet sheet = workbook.getWorksheets().get(0);
//Save the sheet as CSV
sheet.saveToFile("output/ToCSV_out.csv", ",", Charset.forName("UTF-8"));
}
}
For more information, you can read the documentation here: Java: Convert Excel to CSV and Vice Versa
DirectExporter.fromXlsToCsv( xlsFile, csvFile )
.DirectExporter.fromXlsToCsv( xlsFile, csvFile )
is what I was looking for back then. I believe I had a generic CSV comparison library and exporting XLS(X) to CSV would have made it a (reasonably) useful generic XLS(X) comparison. Since it was supposed to be generic, having POJOs for each file is not feasible.