How do i get the content of a spreadsheet cell from an excel file using POI 3.15 (which is supposed to be the latest stable version at the time of this writing) WITHOUT using a deprecated method?
The problem is apparently, in order to read a cell's content, you need to know the cell's type. But from what I can tell, every single way to get a cell's type is deprecated.
What i tried:
- The official documentation: unless i missed something, it looks very incomplete, and doesn't have any example of reading a cell, except this one, which uses the method cell.getCellTypeEnum(), which is deprecated, but returns a non-deprecated org.apache.poi.ss.usermodel.CellType.
- I found this issue on stackoverflow: Get Cell Value from Excel Sheet with Apache Poi , which uses a FormulaEvaluator to evaluate the cell's type. The method evaluateFormulaCell is deprecated, and it is unclear what it currently returns, but it seems to be one of the constants Cell.CELL_TYPE_* (according to the documentation), which are all deprecated.
- Found this tutorial on google, but it's 2 years old already. It mentions using the method cell.getCellType(), which is now deprecated (and also returns one of the deprecated Cell.CELL_TYPE_* constants).
From what i can tell, there is no non-deprecated way to get a cell's type with POI 3.15, and therefore no non-deprecated way to read a spreadsheet using POI 3.15.
The best possible way i could find is using the deprecated method cell.getCellTypeEnum() , since the value it returns is a value from the enum org.apache.poi.ss.usermodel.CellType , which isn't deprecated.
I am correct, or is there a better way to read spreadsheets using POI 3.15?
EDIT: Apparently my conclusion was correct. It will eventually be fixed by Apache POI in a future release.