Excelerate
Excelerate is a gem that adds a modern Ruby API to the classic
ParseExcel library. ParseExcel does a wonderful job of pulling the data
out of an Excel file, but its usability is lacking. Excelerate is
intended to address those woes.
Installation
Install via standard gem installation:
gem install excelerate
Add to Gemfile
:
gem 'excelerate'
Usage
Open a file via URL:
Excelerate.open 'http://example.com/example.xls'
Open a local file:
Excelerate.open 'example.xls'
Select a worksheet:
workbook = Excelerate.open(file)
first_sheet = workbook.first
second_sheet = workbook[1]
Get column headers:
first_sheet.column_headers
Loop through all cells:
first_sheet.each_cell { |cell| puts cell }
Loop through rows or columns:
first_sheet.rows.each { |row| puts row }
first_sheet.columns.each { |row| puts columns }
Grab an individual row or column:
first_sheet.row(4)
first_sheet.column(4)
Other Features
attr_reader
for instance variables- Can open files, strings, or URLs
To do
- Make it work on Heroku by default
Contributing
Just issue a pull request!
License
Released under the MIT license: