Sha256: 4c119450d725bc3650548605a733728f57a1e0c837c4d2cb1ac2e8d7e55d8bd8
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
module ExcelUtils module Sheets class ExcelStream < Base def initialize(spreadsheet:, **options) super(**options) @spreadsheet = spreadsheet end private attr_reader :spreadsheet def first_row row = sheet.each_row_streaming(pad_cells: true, max_rows: 0).first || [] normalize_row row end def each_row sheet.each_row_streaming(pad_cells: true, offset: 1) do |row| yield normalize_row(row) end end def normalize_row(row) row.map { |cell| cell ? cell.value : cell } end def sheet spreadsheet.sheet name end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
excel_utils-1.3.1 | lib/excel_utils/sheets/excel_stream.rb |
excel_utils-1.3.0 | lib/excel_utils/sheets/excel_stream.rb |
excel_utils-1.2.0 | lib/excel_utils/sheets/excel_stream.rb |