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());
Pergunta
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);
Solução
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());