Forum: Ruby on Rails How do I tell roo to open a paperclip attachment after uploaded to later processing?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5a41028798f4e263c2d0692f5b1847ec?d=identicon&s=25 Monserrat Foster (Guest)
on 2013-10-07 16:14
(Received via mailing list)
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.
This topic is locked and can not be replied to.