Ever thought about converting your RoR table to xls and enabling it as an output format in your Rails application controller? Excellent!
Excellent is a name of Ruby on Rails plugin written by stevo which is a custom template handler (XERB) for specifying XLS files just as regular XHTML tables.

Currently EXCELlent (or XERB) supports

  • table, tr, td, th tags
  • table name property for naming sheet
  • font-size, font-weight and color css attributes of cells

Installation is easy, just type ruby script/plugin install git://github.com/stevo/excellent.git
In the console. Before you launch your Rails app you need also install these gems:

gem install spreadsheet
gem install nokogiri

because EXCELlent plugin relies on it. To use it all you need is to set up your controller and view properly. Here are the examples:
Example Ruby on Rails Controller:

def index
@fruits = [{:name => "apple", :color => "green"},{:name => "peach", :color => "orange"}]
 
respond_to do |format|
format.html
format.xml { render :xml => @fruits }
format.xls # Here it is !
end
end

Example Ruby on Rails View:

<table>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td style="font-size: 20px;">Name</td>
<td>Color</td>
</tr>
<tr>
<td style="color: red; font-weight: bold;"></td>
<td></td>
</tr>
</tbody>
</table>

Then all you need is to add a link like this in your view:

To harness the power of Ruby on Rails excellent plugin by stevo!