Sha256: 3c437eb810065e6a3a9bed786640071c86d335ebe194f47a380520ca56c0a1d6

Contents?: true

Size: 615 Bytes

Versions: 9

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

require "spreadsheet"

module Decidim
  module TermCustomizer
    module Import
      module Readers
        # Imports any exported XLS file to local objects. It transforms the
        # import data using the parser 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

9 entries across 9 versions & 1 rubygems

Version Path
decidim-term_customizer-0.23.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.22.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.21.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.20.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.19.1 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.19.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.18.0 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.17.1 lib/decidim/term_customizer/import/readers/xls.rb
decidim-term_customizer-0.17.0 lib/decidim/term_customizer/import/readers/xls.rb