class DataImp::Parser::Spreadsheet

Public Instance Methods

options() click to toggle source
# File lib/data_imp/parser/spreadsheet.rb, line 3
def options
  { }
end
process(input, &block) click to toggle source
# File lib/data_imp/parser/spreadsheet.rb, line 17
def process input, &block
  raise "unable to process spreadsheet as a stream"
end
process_file() { |hash, index| ... } click to toggle source
# File lib/data_imp/parser/spreadsheet.rb, line 7
def process_file &block
  spreadsheet = Roo::Spreadsheet.open(filename, options)
  header = spreadsheet.row(1)
  (2..spreadsheet.last_row).each do |index|
    row = spreadsheet.row(index)
    hash = [header, row].transpose.to_h
    yield hash, index
  end
end