title: How to export data from model to excel file on rubyonrails
body: <p>I'm trying to export data from my models to an excel spreadsheet. I have seen 3 ways</p>
  
  <ol>
  <li>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.</li>
  <li>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. </li>
  <li>Followed this tutorial, <a href="http://oldwiki.rubyonrails.org/rails/pages/HowToExportToExcel" rel="noreferrer">http://oldwiki.rubyonrails.org/rails/pages/HowToExportToExcel</a>,
  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.</li>
  </ol>