I'm trying to read some cells in a line, first 5 sheets using the same reading code were ok, but my 6th sheet is returning a null value in a specific cell even when the cell has value in the spreadsheet.
Has anyone seen this one before? How to solve it?
Thanks in advance!
PS.: here's the code I'm using to get the values, works fine 'til it reaches the 6th sheet. I can see that the Excel spreadsheet is filled but still getting a null.
private String getValorTexto(HSSFSheet sheet, int indiceLinha, int indiceColuna)
{
sheet.getRow(indiceLinha).getCell(indiceColuna).setCellType(HSSFCell.CELL_TYPE_STRING);
if (sheet.getRow(indiceLinha).getCell(indiceColuna).getCellType() == HSSFCell.CELL_TYPE_STRING) {
return sheet.getRow(indiceLinha).getCell(indiceColuna).getStringCellValue().trim();
} else {
return String.valueOf(sheet.getRow(indiceLinha).getCell(indiceColuna).getNumericCellValue());
}
}
indiceLinhaandindiceColuna? Indexes into rows and columns are 0-based in Apache POI, so that "A1" corresponds to (0, 0), not (1, 1).