Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert Excel Spreadsheets to CSV and CSV to XLS/XLSX in Java
// Convert CSV files to XLS/XLSX format in Java
CsvLoadOptions loadOptions = new CsvLoadOptions();
loadOptions.setSeparator(',');
Converter converter = new Converter("path/comma-sparated-values.csv", loadOptions);
SpreadsheetConvertOptions options = new SpreadsheetConvertOptions();
options.setFormat(SpreadsheetFileType.Xlsx);
converter.convert("path/spreadsheet.xlsx", options);
// Convert Excel Spreadsheets to Comma Separated Values CSV format in Java
Converter converter = new Converter("path/spreadsheet.xlsx");
SpreadsheetConvertOptions options = new SpreadsheetConvertOptions();
options.setFormat(SpreadsheetFileType.Csv); // Specify the conversion format
converter.convert("path/convertedfile.csv", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment