I have a problem when import the excel file, when extension is.xls its working properly but when extension is .xlsx it give argument errors.
def 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, packed: nil, file_warning: :ignore)
when ".xlsx" then Roo::Excelx.new(file.path, nil, :ignore)
else raise "Unknown file type: #{file.original_filename}"
end
end
Try
I have solved my problem, doing some changes in that case
If you look at the documentation, Roo::Excelx.new (initialize method) only takes two arguments.
http://www.rubydoc.info/gems/roo/Roo/Excelx
Change line 6 to: