Class: ReadExcel

Inherits:
Object
  • Object
show all
Defined in:
lib/read_excel.rb,
lib/read_excel/version.rb

Defined Under Namespace

Classes: Error, XLSReader, XLSXReader

Constant Summary collapse

VERSION =
"0.9.1"

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ ReadExcel

Returns a new instance of ReadExcel.



8
9
10
11
12
13
14
15
16
17
# File 'lib/read_excel.rb', line 8

def initialize(filepath)
  @filepath = filepath
  if @filepath =~ /xls\Z/i
    @read_adapter = ReadExcel::XLSReader.new(filepath)
  elsif @filepath =~ /xlsx\Z/i
    @read_adapter = ReadExcel::XLSXReader.new(filepath)
  else
    raise "#{filepath} doesn't seem excel file."
  end
end

Instance Method Details

#worksheetsObject

list of worksheets



20
21
22
# File 'lib/read_excel.rb', line 20

def worksheets
  @read_adapter.worksheets
end