Class: Decidim::Admin::Import::Readers::XLS

Inherits:
Base
  • Object
show all
Defined in:
lib/decidim/admin/import/readers/xls.rb

Overview

Imports any exported XLS file to local objects. It transforms the import data using the creator into the final target objects.

Constant Summary collapse

MIME_TYPE =
"application/vnd.ms-excel"

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Decidim::Admin::Import::Readers::Base

Instance Method Details

#read_rowsObject



14
15
16
17
18
19
20
# File 'lib/decidim/admin/import/readers/xls.rb', line 14

def read_rows
  book = ::Spreadsheet.open(file)
  sheet = book.worksheet(0)
  sheet.each_with_index do |row, index|
    yield row.to_a, index
  end
end