JSP导入EXCEL文件,并把EXCEL中数据保存到SQLSERVER数据库中?
发布网友
发布时间:2022-04-08 08:34
我来回答
共1个回答
热心网友
时间:2022-04-08 10:03
InputStream in = new FileInputStream(你的excel文件);
XSSFWorkbook book = new XSSFWorkbook(in);
XSSFSheet sheet = book.getSheetAt(0);
for(int i = sheet.getFirstRowNum()+1; i < sheet.getPhysicalNumberOfRows(); i++){
XSSFRow row = sheet.getRow(i);
for(int j = row.getFirstCellNum(); j < row.getPhysicalNumberOfCells(); j++) {
String cell=row.getCell(j).toString(); //遍历的单元格 }
}