• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

reading xlsx example issue

 
Ranch Hand
Posts: 996
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 996
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic