Module: ExcelUtils

Defined in:
lib/excel_utils.rb,
lib/excel_utils/writer.rb,
lib/excel_utils/version.rb,
lib/excel_utils/sheets/csv.rb,
lib/excel_utils/sheets/base.rb,
lib/excel_utils/sheets/excel.rb,
lib/excel_utils/workbooks/csv.rb,
lib/excel_utils/workbooks/excel.rb,
lib/excel_utils/sheets/excel_stream.rb

Defined Under Namespace

Modules: Sheets, Workbooks Classes: Writer

Constant Summary collapse

VERSION =
'1.3.0'

Class Method Summary collapse

Class Method Details

.read(filename, **options) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/excel_utils.rb', line 20

def self.read(filename, **options)
  extension = options.fetch(:extension, File.extname(filename)[1..-1])
  if extension == 'csv'
    Workbooks::CSV.new(filename, **options)
  else
    Workbooks::Excel.new(filename, **options)
  end
end

.write(filename, data) ⇒ Object



29
30
31
# File 'lib/excel_utils.rb', line 29

def self.write(filename, data)
  Writer.write filename, data
end