美文网首页
读取EXCEL

读取EXCEL

作者: 翘少楚 | 来源:发表于2019-04-19 10:08 被阅读0次

    public int biubiu() throws Exception {
    String fileToBeRead = "D:\xinkai\demo.xls";//要打開的Excel的位置
    HSSFWorkbook excel = new HSSFWorkbook(new FileInputStream(fileToBeRead));

        HSSFSheet sheet = excel.getSheetAt(0);
    
        if (sheet != null) {
            for (int i = 0; i < sheet.getLastRowNum(); i++) {
                HSSFRow rows = sheet.getRow(i);
                if (rows != null) {
                    HSSFCell cell_0 = rows.getCell(0);
                    HSSFCell cell_1 = rows.getCell(1);
                }
            }
        }
        return 1;
    }

    相关文章

      网友评论

          本文标题:读取EXCEL

          本文链接:https://www.haomeiwen.com/subject/esofgqtx.html