Is there any way I can get to the formatted value that excel shows in a row, versus the raw value I am getting returned from the stream?
Or would this fall under the "formula evaluation" category, which this does not support?
Evaluate the Formula to Get the Cell Value Apache POI provides a FormulaEvaluator class, which enables us to calculate the results of formulas in Excel sheets. So, we can use FormulaEvaluator to calculate the cell value at runtime directly.
In Excel sheet before entering a numeric value inside a cell ,enter ~ symbol(tild) and enter the value. For Example: ~123. This might help you. You can use a POI DataFormatter to automatically convert any Cell type to String.
We can get the value of a cell (its content) by using the INDEX Function. The INDEX Function looks up a cell contained within a specified range and returns its value. In the example above, the range specified in the INDEX formula is “A1:J10”, the row is cell “C3” (“3”), and the column is cell “C4” (“5”).
If you have the Cell
that you're trying to get the data out of, try the following
DataFormatter formatter = new DataFormatter();
String formattedCellValue = formatter.formatCellValue(myCell);
If that doesn't get exactly what you're looking for, there are a number of different methods in the DataFormatter
class that do the trick. Check out the API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With