File file = new File("test.xls"); try { Workbook wb = Workbook.getWorkbook(file); Sheet ws = (Sheet) wb.getSheet(0);//根据下标获取sheet Cell A1 = (Cell)ws.getCell(0,0);//获取单元格对象 String dataStr = A1.getContents(); System.out.println(dataStr); } catch (IOException e) { e.printStackTrace(); } catch (BiffException e) { e.printStackTrace(); }
结果:
输出:第一列第一行
注:读取文件时如果位置没错,但报:jxl.read.biff.BiffException: The input file was not found异常,原因可能是文件大小为零或文件无法读取。