如何读取xlsx表格内容
需要jar包:
dom4j-2.1.1jar
commons-io-2.6.jar
poi-4.0.0.jar
poi-ooxml-4.0.0.jar
poi-ooxml-schemas-4.0.0.jar
poi-scratchpad-3.9.jar
xmlbeans-3.0.1.jar
CeshiService ceshiservice=new CeshiService();
File fi=new File(路徑);
FileInputStream in=null;
try{
in =new FileInputStream(fi);
}catch(FileNotFoundException e1){
e1.printStackTrace();
}
XSSFWorkbook wb=null;
try{
wb=new XSSFWorkbook(in);
}catch(IOException e){
e.prinStackTrace();
}
Sheet sheet=wb.getSheetAt(0);
int fristRowNum=sheet.gerFirstRowNum();
int lastRowNum=sheet.getLastRowNum();
Row row=null;
for(int i=FirstRowNum+1;i<lastRowNum;i++){
row=sheet.getRow(i);//獲取第一行數據
Cell cell=row.getCell(0);//獲取i行第一列數據
}
總結
以上是生活随笔為你收集整理的如何读取xlsx表格内容的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 多进程相关内容
- 下一篇: python超神之路:python异常对