Search code examples
javadatecellapache-poipoi-hssf

How to determine whether a spread-sheet cell contains a date, or a real number?


When a cell in a spreadsheet contains a simple date (mm/dd/yyyy) the poi API flags the cell-type as 'numeric'. This is probably because spreadsheets ( IMO ) historically recognize only strings and real numbers.

It is possible to hard-code the cell-index, and use it conditionally to call 'getDateCellValue'. But this feels like a hack.

What other ways are there in the poi API to determine whether the content in a cell is a Date rather than a real number?


Solution

  • The answer is in the Getting the Cell Contents section of the HSSF Quick Guide