Skip to content

Instantly share code, notes, and snippets.

@cpkenn09y
Created January 6, 2016 00:59
Show Gist options
  • Save cpkenn09y/8602ac172373fd92e90a to your computer and use it in GitHub Desktop.
Save cpkenn09y/8602ac172373fd92e90a to your computer and use it in GitHub Desktop.
Simple implementation of opening a excel file
@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