/**李树超 * import form by Excel */ @Transactional public void readByExcel(File upload){ try { FileInputStream file = new FileInputStream(upload); //Create Workbook instance holding reference to .xlsx file XSSFWorkbook workbook = new XSSFWorkbook(file); //Get first/desired sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); //Iterate through each rows one by one Iterator<Row> rowIterator = sheet.iterator(); while (rowIterator.hasNext()){ Row row = rowIterator.next(); List<String> list = new ArrayList<String>(); //For each row, iterate through all the columns Iterator<Cell> cellIterator = row.cellIterator(); while (cellIterator.hasNext()){ Cell cell = cellIterator.next(); if (cell.getColumnIndex() > 19){ break; } String cellValue = ""; //Check the cell type and format accordingly switch (cell.getCellType()){ case Cell.CELL_TYPE_NUMERIC: cellValue = String.valueOf(cell.getNumericCellValue()); break; case Cell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; } list.add(cellValue); } list.add("11111_NO"); list.add(""); list.add(""); list.add(""); list.add(""); //materialStockedDAO.insertBySql(list); System.out.println(""); } file.close(); } catch (Exception e){ e.printStackTrace(); } }
相关推荐
java 读取Excel文件中的内容 java 读取Excel文件中的内容
java读写excel文件,新手参考高手绕道。
使用Java读取Excel文件的内容,主要是使用POI框架,可以读取最新的Excel文件xlsx后缀文件,即2007版本之后的。
poi.zip java读取excel文件,其中bin压缩文件中含有jar包,eclipse导入时可直接使用;src压缩文件含有java源代码,需要阅读源码的童鞋可以下载使用
如何利用java来编写读取excel的方法,代码
java读取xls中的数据,每个对象对应多个属性值,根据每个对象的属性值来生成一个二维矩阵
2、java读取数据库数据,并导出为excel文件。 3、README.md中有详细的操作步骤示例。 使用说明: 1. 先使用postman导入:other/excel相关.postman_collection.json 2. 导入sql到数据库:other/excel.sql 3. idea导入...
java读取excel文件资料java读取excel文件资料java读取excel文件资料
完美解决java读取excel内存溢出问题,希望可以帮到大家
java读取excel文件jar包20181223号传的,没积分可以加我q:504614708,免费给你们
java读取Excel文件 ,可用于安卓开发,将Excel文件导入安卓的数据库中。
Java读取xls、CSV、xlsx文件所用到的jar包,包括: dom4j-1.6.1.jar geronimo-stax-api_1.0_spec-1.0.jar opencsv-2.3.jar poi-3.7-20101029.jar poi-examples-3.7-20101029.jar poi-ooxml-3.7-20101029.jar poi-...
java使用的jpoi读取execl文件 该资源含有最新的poi的jar包 可以用来读取execlxls xlsx两种格式 里面含有代码可以直接运行
Java读取xls、CSV、xlsx文件所用到的jar包,包括:opencsv-2.3.jar、poi-3.7-20101029.jar、poi-ooxml-3.7-20101029.jar
java读取Excel文件-jxl附件列表: ReadAndWriteExcel.java (5.52 KB) jxl.jar (688.03 KB) jxl读Excel文件.doc (88.50 KB)
java读取excel数据导入数据库源码 java读取excel数据导入数据库源码
Java读写文件-Excel