Sha256: 50323ed823e24fd6a9375deccabe38e5605ffdf00cc61de6d59510f1c3606dad

Contents?: true

Size: 607 Bytes

Versions: 6

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

require "spreadsheet"

module Decidim
  module Admin
    module Import
      module Readers
        # Imports any exported XLS file to local objects. It transforms the
        # import data using the creator into the final target objects.
        class XLS < Base
          MIME_TYPE = "application/vnd.ms-excel"

          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
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.24.3 lib/decidim/admin/import/readers/xls.rb
decidim-admin-0.24.2 lib/decidim/admin/import/readers/xls.rb
decidim-admin-0.24.1 lib/decidim/admin/import/readers/xls.rb
decidim-admin-0.24.0 lib/decidim/admin/import/readers/xls.rb
decidim-admin-0.24.0.rc2 lib/decidim/admin/import/readers/xls.rb
decidim-admin-0.24.0.rc1 lib/decidim/admin/import/readers/xls.rb