Alternative to deprecated getCellType
Solution 1:
The accepted answer shows the reason for the deprecation but misses to name the alternative:
CellType getCellTypeEnum()
where the CellType
is the enum decribing the type of the cell.
The plan is to rename getCellTypeEnum()
back to getCellType()
in POI 4.0.
Solution 2:
You can use:
cell.getCellTypeEnum()
Further to compare the cell type, you have to use CellType as follows:-
if(cell.getCellTypeEnum() == CellType.STRING){
.
.
.
}
You can Refer to the documentation. Its pretty helpful:-
https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html