Created
January 6, 2016 00:59
-
-
Save cpkenn09y/8602ac172373fd92e90a to your computer and use it in GitHub Desktop.
Simple implementation of opening a excel file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@xlsx = Roo::Spreadsheet.open(params[:file]) | |
@header = @xlsx.sheet(0).row(1) # ["name", "ssn"] | |
@body = [] | |
@xlsx.sheet(0).each_with_index(:name => 'name', :ssn => 'ssn') do |hash, index| | |
if (index == 0) | |
else | |
@body << hash | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment