Hello, I’m new to ruby and rails… I was planning to use the
spreadsheet
gem to open the files but it doesn’t support xlsx.
I saw this as an example on how to do the same using paperclip
@workbook = Spreadsheet.open(MyFile.first.attachment.to_file)
I imagine with roo would be something like
In this example the model MyFile has_attached_file :attachment
@workbook = Roo::Excelx.new(MyFile.first.attachment.to_file)
Like I said I’m new to Ruby and Rails, so I don’t know what’s “first”,
I assume it refers to the first record (the lastest) on the MyFile
corresponding Table
Is this the right way to do it? I find the use of “new” confusing,
although it says loads an Excel Spreadsheet for Excel .xlsx files I
think it’s creating a new one instead of loading the attachment. Thank
you for your guidance in advance.