Class: ReadExcel::XLSReader

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

Defined Under Namespace

Classes: Worksheet

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ XLSReader

Returns a new instance of XLSReader.



32
33
34
35
# File 'lib/read_excel/xls_reader.rb', line 32

def initialize(filepath)
  @workbook = Spreadsheet.open(filepath)
  @worksheets = []
end

Instance Method Details

#worksheetsObject



37
38
39
40
41
42
43
44
45
# File 'lib/read_excel/xls_reader.rb', line 37

def worksheets
  if @worksheets.empty?
    @workbook.worksheets.each do |worksheet|
      @worksheets << Worksheet.new(worksheet)
    end
  end

  @worksheets
end