try { if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { FormulaEvaluator fe = workbook.getCreationHelper().createFormulaEvaluator(); String formatCellValue = formatter.formatCellValue(cell, fe); System.out.println("FE : " + formatCellValue); } } catch (NotImplementedException et) { System.err.println("ERR : " + et.getMessage()); // String j_username = formatter.formatCellValue(cell); // System.out.println(j_username); System.out.println(cell.getNumericCellValue()); From above code, I could get RSQ function cell(formula cell) value by cell.getNumericCellValue() but after writing it by output stream, I could not get cell value from output file.
For formula cells, you need to check the cached formula result type, and fetch the cell's value based on that - https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html#getCachedFormulaResultType%28%29 . You cannot blindly fetch the numeric value for formula cells, as many formulas don't resolve to numbers, eg they give a String or an Error (as in your case)