Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Workbook workbook = new Workbook(file);
- Sheet sheet = workbook.getSheetAt(0); // get first sheet
- Iterator<Row> iterator = sheet.iterator();
- while (iterator.hasNext()) {
- Iterator<Cell> cellIterator = iterator.next().iterator();
- while (cellIterator.hasNext()) {
- Cell c = cellIterator.next();
- // add to data structure
- }
- }
- String[][] data; // loaded from XLSX
- CSVPrinter printer = new CSVPrinter(new File("output.csv"), CSVFormat.DEFAULT);
- printer.printRecord("Column 1", "Column 2", "Column 3"); // print header
- for (String[] strings : data) {
- printer.printRecord(strings[0], strings[1], strings[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement