Class: Sheets::Parsers::ExcelParser

Inherits:
Base
  • Object
show all
Defined in:
lib/sheets/parsers/excel_parser.rb

Instance Method Summary collapse

Methods inherited from Base

formats, formats=, #initialize, #io, parses

Constructor Details

This class inherits a constructor from Sheets::Parsers::Base

Instance Method Details

#to_arrayObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/sheets/parsers/excel_parser.rb', line 6

def to_array
  workbook = Spreadsheet.open(@file_path)
  worksheet = workbook.worksheet(0)
  # worksheet.collect {|row| row.collect {|cell| cell } }
  worksheet.collect do |row|
    cells = []
    row.count.times {|cell_index| cells << row[cell_index].to_s }
    cells
  end
end