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

reading xlsx example issue

 
sai rama krishna
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I was trying above example from link


http://techtadka.net/articles/programming/208-code-for-reading-a-xlsx-file-in-java.html


using attached cccc.xlsx.

I am getting following error. Please advise
number of rows---->1
java.lang.IllegalStateException: Cannot get a text value from a numeric cell
at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:845)
at org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:294)
at org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:246)
at sssssssss.ReadSheet(sssssssss.java:60)
at sssssssss.main(sssssssss.java:98)





Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.IllegalStateException: Cannot get a text value from a numeric cell

You have a value which is a Number. You try to get text from it. You should instead try to get a Number from it.
 
sai rama krishna
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I changed like above now able to read only few values not all as below

number of rows---->1
aa
77-SS_001
DONE
aa
77-SS_002
NoDONE


>>You should instead try to get a Number from it.

How to get Number instead of string. Please advise
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic