Class: ReadExcel
- Inherits:
-
Object
- Object
- ReadExcel
- 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
-
#initialize(filepath) ⇒ ReadExcel
constructor
A new instance of ReadExcel.
-
#worksheets ⇒ Object
list of worksheets.
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
#worksheets ⇒ Object
list of worksheets
20 21 22 |
# File 'lib/read_excel.rb', line 20 def worksheets @read_adapter.worksheets end |