读取EXCEL
2019-04-19 本文已影响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;
}