aviks / Taro.jl

Read and write Excel, Word and PDF documents in Julia
Other
124 stars 25 forks source link

Exception "Cannot get a text value from a numeric cell" #23

Closed axsk closed 8 years ago

axsk commented 8 years ago

This happens when I try to read in a .xls file

Exception in thread "main" java.lang.IllegalStateException: Cannot get a text value from a numeric cell
        at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:648)
        at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:725)
        at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:708)
ERROR: Error calling Java: java.lang.IllegalStateException: Cannot get a text value from a numeric cell
 in error at ./error.jl:21
 in geterror at /datanumerik/bzfsikor/julia/pkg/v0.4/JavaCall/src/core.jl:243
 in _jcall at /datanumerik/bzfsikor/julia/pkg/v0.4/JavaCall/src/core.jl:211
 in jcall at /datanumerik/bzfsikor/julia/pkg/v0.4/JavaCall/src/core.jl:124
 in readxl at /datanumerik/bzfsikor/julia/pkg/v0.4/Taro/src/Taro.jl:163
 in readxl at /datanumerik/bzfsikor/julia/pkg/v0.4/Taro/src/Taro.jl:125
aviks commented 8 years ago

This happens when you try to retrieve a numerical value as a string. Are you calling the the getStringCellValue method? What code+file causes this error?

axsk commented 8 years ago

I just called readxl. Unfortunately I cannot reproduce it as I exported the sheets to .csv and now read them in :(

aviks commented 8 years ago

OK, i figured out why that is.. .this is due to readxl trying to read the top row as headers, which should be all text. If you don't have headers, then headers=false must be passed as a parameter. I'll report a better error message for this case.