Skip to content

Instantly share code, notes, and snippets.

@Mifrill
Last active March 3, 2018 10:21
Show Gist options
  • Save Mifrill/b8448c9adda997b664a4cd973cd09b97 to your computer and use it in GitHub Desktop.
Save Mifrill/b8448c9adda997b664a4cd973cd09b97 to your computer and use it in GitHub Desktop.
mifrill@mifrill-desktop:~/Documents$ ls
comments.xls
mifrill@mifrill-desktop:~/Documents$ ruby -v 
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
mifrill@mifrill-desktop:~/Documents$ gem install roo
Fetching: rubyzip-1.2.1.gem (100%)
Successfully installed rubyzip-1.2.1
Fetching: roo-2.7.1.gem (100%)
Successfully installed roo-2.7.1
Parsing documentation for rubyzip-1.2.1
Installing ri documentation for rubyzip-1.2.1
Parsing documentation for roo-2.7.1
Installing ri documentation for roo-2.7.1
Done installing documentation for rubyzip, roo after 1 seconds
2 gems installed
mifrill@mifrill-desktop:~/Documents$ gem install roo-xls
Successfully installed roo-xls-1.2.0
Parsing documentation for roo-xls-1.2.0
Done installing documentation for roo-xls after 0 seconds
1 gem installed

mifrill@mifrill-desktop:~/Documents$ irb
irb(main):001:0> require "roo"
=> true
irb(main):002:0> require "roo-xls"
=> true
irb(main):003:0> require "roo/version"
=> true
irb(main):004:0> Roo::VERSION
=> "2.7.1"
irb(main):005:0> Roo::Xls::VERSION
=> "1.2.0"
irb(main):006:0> sheet = Roo::Spreadsheet.open("/home/mifrill/Documents/comments.xls", extension: "xls")
=> <#Roo::Excel:1255777106262450 @filename @workbook @options @cell @cell_type @cells_read @first_row @last_row @first_column @last_column @header_line @formula @fonts>
irb(main):007:0> sheet.first
Traceback (most recent call last):
       12: from /home/mifrill/.rbenv/versions/2.5.0/bin/irb:11:in `<main>'
       11: from (irb):16
       10: from (irb):16:in `first'
        9: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/roo-2.7.1/lib/roo/base.rb:282:in `each'
        8: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/roo-2.7.1/lib/roo/base.rb:116:in `last_row'
        7: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/roo-xls-1.2.0/lib/roo/xls/excel.rb:252:in `read_cells'
        6: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/worksheet.rb:46:in `each'
        5: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/worksheet.rb:53:in `ensure_rows_read'
        4: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/reader.rb:863:in `read_worksheet'
        3: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/reader.rb:127:in `postread_worksheet'
        2: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/reader.rb:127:in `each'
        1: from /home/mifrill/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spreadsheet-1.1.5/lib/spreadsheet/excel/reader.rb:132:in `block in postread_worksheet'
NoMethodError (undefined method `text' for nil:NilClass)
irb(main):008:0> sheet.first
=> ["Referencia", "Nombre del producto", "Descripción", "Categoría Solostocks", "Categoría", "Tiempo de entrega (en horas)", "Pedido mínimo", "Unidad de medida", "Unidad de medida \"Otro\"", "Activar la venta online", "IVA (%)", "Gastos de envío", "Stock disponible", "Incrementos a partir del pedido mínimo", "Potencia", "Modelo", "Marca", "URL imagen 1", "URL imagen 2", "URL imagen 3", "URL imagen 4", "URL imagen 5", "URL vídeo del producto", "Descripción vídeo del producto", "Palabras/s clave 1", "Palabras/s clave 2", "Palabras/s clave 3", "Palabras/s clave 4", "Palabras/s clave 5", "Precio", "Rango 1 desde", "Rango 1 hasta", "Rango 1 precio", "Rango 2 desde", "Rango 2 hasta", "Rango 2 precio", "Rango 3 desde", "Rango 3 hasta", "Rango 3 precio", "Rango 4 desde", "Rango 4 hasta", "Rango 4 precio", "Rango 5 desde", "Rango 5 hasta", "Rango 5 precio", "Número mundial del artículo (GTIN)", "Número de referencia del fabricante (MPN)"]

comments.xls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment