Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@farhan-raza
Last active September 10, 2020 22:12
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 farhan-raza/040146432340e171e55953a1795a563a to your computer and use it in GitHub Desktop.
Save farhan-raza/040146432340e171e55953a1795a563a to your computer and use it in GitHub Desktop.
Excel XLSX XLS to CSV or CSV to Excel using Java
// Opening CSV Files
// Creating CSV LoadOptions object
LoadOptions loadOptions = new LoadOptions(FileFormatType.CSV);
// Creating an Workbook object with CSV file path and the loadOptions
// object
Workbook workbook = new Workbook(dataDir + "Book_CSV.csv", loadOptions);
workbook.save(dataDir + "CSVtoExcel.xlsx" , SaveFormat.XLSX);
// Load the input Excel file
Workbook workbook = new Workbook(dataDir + "CSVtoExcel.xlsx");
// Save output CSV file
workbook.save(dataDir + "ExcelToCSV.csv" , SaveFormat.CSV);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment