Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floats formatted as Ints not being rounded #60

Open
dorsma opened this issue Aug 16, 2024 · 0 comments
Open

Floats formatted as Ints not being rounded #60

dorsma opened this issue Aug 16, 2024 · 0 comments

Comments

@dorsma
Copy link

dorsma commented Aug 16, 2024

I believe this is the same as issue #16

I have a spreadsheet that contains float values in two columns, with column B formatted the floats as integers. In the spreadsheet I see the column B values rounded, however when I read those values though simple_xlsx_reader column B values are floored.

require 'simple_xlsx_reader'

reader = SimpleXlsxReader.open('FLOATS_FORMATTED_AS_INTs.xlsx')
worksheet = reader.sheets.first

worksheet.rows.each do |row|
  break if not row[0]
  puts "#{row[0]}, #{row[1]}"
end

Output:

ORIG FLOAT, INT FORMAT
22.33, 22
21.69, 21
22.25, 22
22.24, 22
21.54, 21
21.71, 21
21.34, 21
21.22, 21
21.35, 21
20.83, 20
20.5, 20

Compare to the screenshot from the spreadsheet:
FLOATS_FORMATTED_AS_INTs

Spreadsheet attached:

FLOATS_FORMATTED_AS_INTs.xlsx

Is there any way we could have access to the actual non-formatted cell value? eg. row[1].actual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant