// 读取excel文件内容
Workbook book = null;
try {
book = Workbook.getWorkbook(new File("d://e.xls"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Sheet sheet = book.getSheet(0);
int rows = sheet.getRows();
int cols = sheet.getColumns();
for (int index = 1; index < rows; index++) {
Cell[] cell_domain = sheet.getRow(index);
for (int j = 0; j < cell_domain.length; j++) {
String name="";
String age="";
if(j==0){
name=cell_domain[j].getContents();
}
if(j==1){
age=cell_domain[j].getContents();
}
}
}
读取excel文件内容
最新推荐文章于 2024-07-29 14:45:46 发布