rubyexcel阅读器,电子表格gem

我想读取一个ruby的Excel文件,然后把数据,并将其插入到MySQL数据库。 我正在使用电子表格:: Excel和MySQL的gem。 由于某种原因,我似乎无法使用电子表格gem打开文件阅读…这是我的代码

require 'rubygems' require 'spreadsheet' require 'mysql' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet.open '/home/data/teams.xlsb' b1 = book.worksheet('team1') 

当我运行脚本时,我得到这个奇怪的错误

 /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:376:in `validate!': OLE2 signature is invalid (Ole::Storage::FormatError) from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:368:in `initialize' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:110:in `new' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:110:in `load' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:77:in `initialize' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:83:in `new' from /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.11.1/lib/ole/storage/base.rb:83:in `open' from /usr/local/lib/ruby/gems/1.8/gems/spreadsheet-0.6.5.8/lib/spreadsheet/excel/reader.rb:1144:in `setup' from /usr/local/lib/ruby/gems/1.8/gems/spreadsheet-0.6.5.8/lib/spreadsheet/excel/reader.rb:121:in `read' from /usr/local/lib/ruby/gems/1.8/gems/spreadsheet-0.6.5.8/lib/spreadsheet/excel/workbook.rb:32:in `open' from /usr/local/lib/ruby/gems/1.8/gems/spreadsheet-0.6.5.8/lib/spreadsheet.rb:62:in `open' from /usr/local/lib/ruby/gems/1.8/gems/spreadsheet-0.6.5.8/lib/spreadsheet.rb:68:in `open' from sizes_importer2.rb:7 

我在某处看到这个gem可能无法支持.xlsb文件。 我不知道这是不是真的,但如果是有人能告诉我如何绕过它,或者如果有什么不对吗? 我完全失去了,将不胜感激这个错误的任何帮助。 谢谢

你已经看过roo了吗? – > http://rubygems.org/gems/roo