i have excel file (.xlsx) with column
Column1 Column2 Column3 Column1
A 50 30 40
B 45 40 20
.......................................
I need to import this excel in MySQL database. I use following code:
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream(new File("Data.xlsx"));
XSSFWorkbook workbook = new XSSFWorkbook (fis);
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator ite = sheet.rowIterator();
while(ite.hasNext()){
Row row = (Row) ite.next();
Iterator<Cell> cite = row.cellIterator();
while(cite.hasNext()){
Cell c = cite.next();
System.out.print(c.toString() +";");
}
System.out.println();
}
fis.close();
}
I need to get in list all row. This code show in console all data from row, but I don't now to add that data in list and list import to MySQL.
Any idea?