Detect empty header with LightCellsDataHandler

When we read data through LightCellsDataHandler, it gives cells which have data within.

There can be cases when there is data in the column, but the column header is empty.

E.g. In the attached excel sheet, data is present in column A and in column C, but the value in A1, C1 is empty. So LightCellsDataHandler does NOT call processCell() for the cells: A1, C1.

When I contine reading excel sheet, I will find that A2 has data so column A exists.

Is there any way so that I can detect that column A exists just when the A1 is skipped by LightCellsDataHandler?

FYI: worksheet.getCells().getMaxColumn() and worksheet.getCells().getMinColumn() seem to be useful. But, for large excel sheets, getCells() throws OutOfMemory error. That’s the purpose I need to use LightCellsDataHandler. So, I can’t use getCells() method.

Hi,


I am afraid, we cannot support your requirements in LightCells
API. The LightCells API is designed mainly for the users to read/process cells data in the
sequence of how the cells data has been saved in the template file. To check
whether one column is empty or has cells, we still have to traverse all cells
in the sheet sequentially. If you need to gather some global information such
as empty columns, maximum rows, columns, and so on, you should load the
workbook one more time with different handler to gather it.

Thank you.

Thanks.
Used one handler to collect the info.
And used that info in another handler.

Hi,


Good to know that you have sorted out your issue now. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.