Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active August 3, 2021 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/f76d26570da3a1c3781cde92da456683 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/f76d26570da3a1c3781cde92da456683 to your computer and use it in GitHub Desktop.
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