You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by rp...@bdrive.com on 2004/04/14 21:06:52 UTC

Reading excel files (was RE:RE:Different dates Formats and Decimals)

Hello Balaji,
Attached is a sample java programs that reads an excel file and echoes the value to the System.out. I am attaching a sample excel file also that you can use to test this class. 
Please change the location of the excel file before compiling and runing it.
You would obviously need to compile this and run it after setting the classpath etc. This works with version 2.5 of POI. The distribution I used is downloaded from 
http://apache.mirrors.pair.com/jakarta/poi/release/bin/
Hope this helps you to do what you are trying.

POI developers,if you think it helps people to understand reading of excel files using the POI library please consider making this part of the POI documentation. If I can help in this regard I would be glad to do that.

Best Regards,

Rahul Phadnis



--- ORIGINAL MESSAGE ---
From:balaji.muniraja@db.com
To: rphadnis@bdrive.com
Subject:RE:Different dates Formats and Decimals
Date: 04/14/2004 09:10:03 AM

Hi,
      Do you have any sample code for reading like that and let me know how do i read a empty cell as a text value ?

Regards,
Balaji.M,
Institutional Client Group(IT),
Deutsche Bank [/], London,
Office : +44(0)20754 55426
                                                                                                                                                             
                      rphadnis@bdrive.c                                                                                                                                
                      om                       To:       Balaji Muniraja/DMGGM/DMG UK/DeuBa@DMG UK                                                                     
                                               cc:       poi-user@jakarta.apache.org                                                                                   
                      04/14/2004 04:56         Subject:  RE:Different dates Formats and Decimals                                                                       
                      PM                                                                                                                                               
                                                                                                                                                                       
                                                                                                                                                                       




Hello,
You can extract the values from excel sheet. Then based on the column type apply formating to the value viz converting dates to dd-mm-yyyy etc. The formatting can be done using the java.text api. After applying necessary formatting these values can then be inserted into the database.

-Rahul Phadnis


--- ORIGINAL MESSAGE ---
From:balaji.muniraja@db.com
To: poi-user@jakarta.apache.org
Subject:Different dates Formats and Decimals
Date: 04/14/2004 08:37:53 AM

Hi ,
      I am newbie to POI.

      I have a requirement, where i need to read each row in the Excel File and upload those rows in to the Oracle Database. I am using the following code to do that. But before reading the Excel file using the Java Programs, i need to 1) Format the Date Columns to (CUSTOM-> dd-mm-yyyy) , number colums to Number and no decimal places  and there are cases where columns in the Excel will be empty (it will be in General Format). If i convert it to Text and run the program then it will work properly.

      What i wanted to know is , Is there any way

      1) To read without modifying the format for the Date values in the Excel Sheet.
      2) If the Excel Column is of General Type and try to read a String Value successfully.

      Many thanks in Advance.

Regards,
Balaji.M,
Institutional Client Group(IT),
Deutsche Bank [/], London,
Office : +44(0)20754 55426


--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org



All the kung fu in the world isn't any help when it comes to women. - Jet Li




--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



It's a recession when your neighbor loses his job; it's a depression when you lose yours - Harry S. Truman