How do I check if a cell contains a date value?

The code below check if the first cell of an Excel file contains a date value.
In Excel the cell type for date is returned as HSSFCell.CELL_TYPE_NUMERIC,
to make sure if it contains a date we can use a utility method
HSSFDateUtil.isCellDateFormatted(HSSFCell cell), this methos will check
if the cell value is a valid date.

How do I obtain Excel’s cell data type?

In this example we try to obtain the Excel’s cell data type so that we can read
the value using the right method. The data to be read is contained in a file named
celltype.xls. The below matrix depict how to file is look like.

Our program iterates the Excel file rows and cells and produce the following
output:

How do I read Excel file?

In this example we demonstrate how to read data from an Excel file. In this example we limit to read a string data only. After reading the data, iterating the each rows and cells of the Excel file we display the content to the program console.

Our program above print out the following lines: