Open amhofny opened 3 years ago
I think we can check for the style :fixnum
or :bignum
to decide whether we should use to_i
or convert_bignum
. Something like this:
when `n`
case style
when :fixnum
value.to_i
when :bignum
convert_bignum(value)
else
value.to_f
end
When reading an excel file that is exported from other libraries, for example caxlsx https://github.com/caxlsx/caxlsx The library generates Excel with floats and integers represented with t="n", for example from the "sheet1.xml"
Both of these numbers are read by Creek as: 1.0 , 114.0, which is causing problems when the system expects to see an integer value instead of float, for example when using that number to load Models from the Database
I have found in this line https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#L47 That Creek always read the value as float.
My suggestion is to replace
with
I don't know if this is the right solution or not, but by applying this as a patch in the system solved our problem.