I am parsing Excel using Apache POI. Is it possible to get Apache POI to treat empty strings as null and ignore them?
There can be excel sheets that sets millions of cells as Text as attached below, causing all the cells to be interpreted as empty strings by Apache POI. Since there are millions of empty string cells, checking cell by cell can cause great performance issue:
Is there anyway where Apache POI can ignore these empty string cells so we don't have to individually read cell by cell to check if the cell is empty string?
InputStream is = new ByteArrayInputStream(content);
Workbook wb = WorkbookFactory.create(is);
wb.setMissingCellPolicy(RETURN_BLANK_AS_NULL);
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
Sheet sheet = wb.getSheetAt(i);
for (int i = firstRowNumber; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i); // Row is returning all the empty strings but I would like to ignore them and treat them as null (empty cell)
// ...
}
}