Hi Intellects,
I'm using Apache POI for reading Excel. I've been asked to store the cells into MySQL 5.1. While I'm reading Excel cells, I've been thrown NullPointerException
.
This is my code snippet :
int rows = sheet.getPhysicalNumberOfRows();
for(int r = 1; r<rows; r++) {
HSSFRow row = sheet.getRow(r);
int cols = row.getLastCellNum();
for(int c=0; c < cols; c++) {
HSSFCell cell = row.getCell(c, Row.CREATE_NULL_AS_BLANK);
switch(cell.getColumnIndex()) {
case 0:
....
....
case 1:
....
....
case ...:
....
....
}
}
}
// Here comes the code to insert into DB
If anyone can identify where it arises, post asap. If I left some logic you need just ask me...