Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help in reading mobile number

 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

Can Anyone please tell me how to read mobile number example:9823145678 in java from excel

Thank you
 
James X Peterson
Whizlabs Java Support
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pooja,

if you know how to read a excel file then you can do it by giving a condition to read only mobile number column from excel file.

Regards,
James
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James
Actually i am new to java so can you elaborate?
Can You Tel Me how to do it..
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you have so far, and where are you stuck making progress? If you haven't started, then you should get familiar with the Apache POI library for reading Excel files.
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have already started
I take file name from text box
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's still missing?
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i cant read correct mobile number. it saves 2147483647 instead of mobile number
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're treating the phone number as an integer, whereas you should be treating it as a string.
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had tried it it gives me exception

java.lang.IllegalStateException: Cannot get a text value from a numeric cell
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you need to change the spreadsheet so it doesn't format that field as a number. Phone numbers are strings, not numbers.
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what will be the format?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which options do you see? Which one do you think makes sense?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic