Reputation: 35
public java.text.Format getDefaultFormat(Cell cell).
I am reading values from an Excel cell and storing it in a database.
The code below is not working, it's giving a type mismatch error.
userdata.setTaskid((int)(row.getCell(0).getNumericCellValue()));
System.out.println(userdata.getTaskid());
Upvotes: 2
Views: 1166
Reputation: 1081
Following code will give you the cell format and then based on that return integer format you can decide the way to get cell value, e.g. either using getNumericCelValue or getBooleanCelValue etc.
int cellType = row.getCell(0).getCellType();
Upvotes: 1