Ruby Reader Excel, large format paper

I try to read the excel file in ruby ​​and then I take the data and paste it into the mysql database. I use tables: excel and mysql. for some reason I can't seem to be able to use a spreadsheet to open the file for reading ... this is my code

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

I get this strange error when I run the script

 /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 

I read somewhere that this stone may not support .xlsb files. I don’t know if this is true or not, but if it can someone tell me how to get around this, or if something else is wrong? I am completely lost and I will be grateful for any help in this error. thanks

+6
source share
1 answer

Have you looked at roo already? -> http://rubygems.org/gems/roo

+5
source

Source: https://habr.com/ru/post/896467/


All Articles