public static void getFormulaCellValue() throws IOException {
FileInputStream fis = new FileInputStream("D:/VM24过程审核报告.xls");
Workbook wb = new HSSFWorkbook(fis);
Sheet sheet = wb.getSheet("过程审核报告");//获取sheet页
Row row = sheet.getRow(12);//行 获取第12行(0索引基数)
System.err.println(row);
Cell cell = row.getCell(13);//列 获取第12个单元格(0索引基数)
switch(cell.getCachedFormulaResultType()) {
case NUMERIC:
System.out.println("数字: " + cell.getNumericCellValue());
break;
case STRING:
System.out.println("文本:" + cell.getRichStringCellValue() );
break;
}
}
public static void main(String[] args) throws IOException {
getFormulaCellValue();
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/a2c08bdb9fa74215a9c08a66ce163883.png)