Sha256: 80aac63202dd6aa24152319a3d0d8a533ce80e19517e8768354609731cb23b66

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

require 'bundler/setup'
require 'minitest/autorun'
require "minitest/reporters"

##Encoding.default_external = Encoding::UTF_8
##Encoding.default_internal = Encoding::UTF_8

require 'date'

Minitest::Reporters.use!(
  Minitest::Reporters::DefaultReporter.new(color: true)
)

require_relative '../lib/fast_excel'

def parse_xlsx(file_path)
  require 'roo'
  Roo::Excelx.new(file_path)
ensure
  File.delete(file_path)
end

def parse_xlsx_as_array(file_path)
  excel = parse_xlsx(file_path)
  data = excel.to_matrix.to_a
  headers = data.shift

  data.map do |row|
    Hash[ [headers, row].transpose ]
  end
end

def parse_xlsx_as_matrix(file_path)
  excel = parse_xlsx(file_path)
  excel.to_matrix.to_a
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fast_excel-0.2.1 test/test_helper.rb
fast_excel-0.2.0 test/test_helper.rb