This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to convert excel sheets exponential cell format to java string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to convert excel sheets exponential cell format to java string " Watch "How to convert excel sheets exponential cell format to java string " New topic
Author

How to convert excel sheets exponential cell format to java string

Vaibhav Naikwade
Greenhorn

Joined: Jun 05, 2007
Posts: 5
Hi All,

I am facing a problem in importing excel sheet in java application and intern inserting rows in oracle database.
One columns in excel sheet is holding numeric value and data length of that particular column is 17 digits.
Excel automatically converting the value of that column in some format (seems exponential) i.e. 12345678901234500 becomes 1.23E+16.
I am parsing this excel file and fetching cells in string, So when i try to ready 12345678901234500 value i get 1.23E+16 and as it is its getting inserted in database.
Does anybody faced similar problem ever? How do I retain or reformat this value. I dont have control over excel sheet so i can't format as its coming by import process from client.

Any help is appreciated.


Vaibhav Naikwade

SCJP 6.0
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It sounds like the problem is with the source file. Can you ask the client why they have data stored in that way?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Vaibhav Naikwade
Greenhorn

Joined: Jun 05, 2007
Posts: 5

Yes right,

Problem is with excel sheet. If I simply enter numeric value more than 10 to 12 digits without any cell formatting
it converts it some form. Its not a scientific notation, so i could not apply reverse formula as well.

Apache POI API would have helped me but I could not use that as well. It will make lots of classes to go in garbage and architectural changes.

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It's best off getting the problem solved in Excel, I assume you can change the properties of the cell in Excel so it can show the larger number correctly?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert excel sheets exponential cell format to java string
 
Similar Threads
. reading data from MS EXcel using apache poi api
Doubt on '#' in query.
HTML Tags through JAVA into Excel Sheet
Reading date from excel file
How to append in excel sheet using Java