RailsCasts Pro episodes are now free!

Learn more or hide this

Prashant's Profile

GitHub User: prcongithub

Site: http://prconblogger.blogspot.com

Comments by Prashant

Avatar

correction with open_spreadsheet method

def self.open_spreadsheet(file)
case File.extname(file.original_filename)
when ".csv" then Roo::Csv.new(file.path, nil, :ignore)
when ".xls" then Roo::Excel.new(file.path, nil, :ignore)
when ".xlsx" then Roo::Excelx.new(file.path, nil, :ignore)
else raise "Unknown file type: #{file.original_filename}"
end
end