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

`Integer': invalid value for Integer(): "" (ArgumentError) during each_row_streaming #541

Open
will89 opened this issue Sep 8, 2020 · 1 comment · May be fixed by #542
Open

`Integer': invalid value for Integer(): "" (ArgumentError) during each_row_streaming #541

will89 opened this issue Sep 8, 2020 · 1 comment · May be fixed by #542

Comments

@will89
Copy link
Contributor

will89 commented Sep 8, 2020

Steps to reproduce

Gist

# frozen_string_literal: true

begin
  require "bundler/inline"
rescue LoadError => e
  $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  #  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "roo"
  gem "minitest"
end

require "roo"
require "minitest/autorun"

class BugTest < Minitest::Test
  def test_stuff
    filepath = 'foo.xlsx'
    reader = Roo::Excelx.new(filepath)
    reader.each_row_streaming do |row|
      assert_equal('', row.value)
    end
  end
end

Spreadsheet

foo.xlsx
I suspect it has to do with this formatting of the cell values in the xml

<c r="AC3">
  <v/>
</c>

Issue

The file does not successfully parse.

Stacktrace

        22: from lib/roo/excelx.rb:299:in `each_row_streaming'
        21: from lib/roo/excelx/sheet.rb:42:in `each_row'
        20: from lib/roo/excelx/sheet_doc.rb:41:in `each_row_streaming'
        19: from lib/roo/utils.rb:106:in `each_element'
        18: from lib/nokogiri/xml/reader.rb:107:in `each'
        17: from lib/roo/utils.rb:108:in `block in each_element'
        16: from lib/roo/excelx/sheet.rb:45:in `block in each_row'
        15: from lib/roo/excelx/sheet.rb:108:in `cells_for_row_element'
        14: from lib/roo/excelx/sheet_doc.rb:48:in `each_cell'
        13: from lib/nokogiri/xml/node_set.rb:237:in `each'
        12: from lib/nokogiri/xml/node_set.rb:237:in `upto'
        11: from lib/nokogiri/xml/node_set.rb:238:in `block in each'
        10: from lib/roo/excelx/sheet_doc.rb:52:in `block in each_cell'
         9: from lib/roo/excelx/sheet_doc.rb:101:in `cell_from_xml'
         8: from lib/nokogiri/xml/node_set.rb:237:in `each'
         7: from lib/nokogiri/xml/node_set.rb:237:in `upto'
         6: from lib/nokogiri/xml/node_set.rb:238:in `block in each'
         5: from lib/roo/excelx/sheet_doc.rb:119:in `block in cell_from_xml'
         4: from lib/roo/excelx/sheet_doc.rb:177:in `create_cell_from_value'
         3: from lib/roo/excelx/sheet_doc.rb:177:in `new'
         2: from lib/roo/excelx/cell/number.rb:16:in `initialize'
         1: from lib/roo/excelx/cell/number.rb:27:in `create_numeric'
             lib/roo/excelx/cell/number.rb:27:in `Integer': invalid value for Integer(): "" (ArgumentError)

System configuration

Roo version: 2.8.3

Ruby version: 2.6.5

@will89 will89 linked a pull request Sep 13, 2020 that will close this issue
@maysam
Copy link

maysam commented May 21, 2022

how is something like this still open?

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

Successfully merging a pull request may close this issue.

2 participants