I’m trying to export data from my models to an excel spreadsheet. I have seen 3 ways
- Using the spreadsheet gem which I didn’t understand how to use it,
the examples I saw was writing to a local file but I’m looking to
generate a file every time user clicks on a link. - Creating a method called export, and running the query there, then
making a export.xls file in my view, and that file creating the
table I want to be exported to the excel file, but this approach
don’t allow me to create multiple sheets. - Followed this tutorial, http://oldwiki.rubyonrails.org/rails/pages/HowToExportToExcel,
but here doesn’t show how to put the link in the view, looks to me that I’m missing something in the routes, I can give github so you can take a look at my code if needed.
My choice is to just manualy generate CSV file. Like:
CSV file can be opened with excel or any other spreadsheet soft.