I want to get content of a cell in Excel whose value is calculated using a Formula (=D6*0.1236) and i am using HssfWorkbook and using getCell() method to get content. But i am getting D6*0.1236. I want to get the value calculated using this formula and not the formula. Please suggest some solution for this.

Below is the code to get the contents

     HSSFSheet sheet = workbook.getSheetAt(1);
     Row r = sheet.getRow(13);
     //get the cell [a particular cell of the row obtained above]
     Cell c = r.getCell(2);
有帮助吗?

解决方案

You are not suppose to use getCell() to fetch a value. Try the following ,

Cell c = r.getCell(2);
System.out.println("The Cell value is " + c.getNumericCellValue());
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top