roo-rb/roo

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

will89 opened this issue · 1 comments

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

how is something like this still open?