Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert excel sheets exponential cell format to java string

 
Vaibhav Naikwade
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like the problem is with the source file. Can you ask the client why they have data stored in that way?
 
Vaibhav Naikwade
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic