在使用excel工作表处理ruby时,我正在使用“roo”gem。 它与我的系统相关的本地文件运行良好。 但是当我从互联网上下载一个新的excel文件并用'roo'打开它时会抛出错误,如
Ruby193 / lib / ruby / gems / 1.9.1 / gems / roo-2.3.2 / lib / roo / excelx.rb:364:in block in extract_sheets_in_order': undefined method 'extract' for nil:NilClass (NoMethodError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:358:in 'each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:358:in 'each_with_index'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:358:in 'extract_sheets_in_order'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:400:in 'process_zipfile_entries'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:379:in 'process_zipfile'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/roo-2.3.2/lib/roo/excelx.rb:48:in 'initialize'
from excel1.rb:5:in 'new'
from excel1.rb:5:in '<main>
roo version =&gt; 2.3.2 OS =&gt; Windows 7