File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Accessing Date columns from Excel worksheets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Accessing Date columns from Excel worksheets" Watch "Accessing Date columns from Excel worksheets" New topic
Author

Accessing Date columns from Excel worksheets

Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hello,

I am using Apache POI to read data from Excel worksheets. The defined types of cell are STRING, NUMERIC, BOOLEAN, BLANK, FORMULA and ERROR. When accessing a date column I think POI computes the date field eg. 12/12/2000 and returns a decimal value and the type of this column is NUMERIC. How do I get the exact contents as a STRING without any mathematical operation (division) being performed?

Thanks,
Rajkamal.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
This sounds odd. If the cell type is text in the original file, then POI should recognize it as such (i.e, as STRING). What type of cell does Excel think it is?


Ping & DNS - my free Android networking tools app
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Sorry, I got caught up in a few things so was not checking the forum.

I finally figured it out. Sample code :



This means even if its a date column its intepreted possibly as a numeric one and then you can check further if its a date type.

Thanks,
Rajkamal.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing Date columns from Excel worksheets