# Respond\_to, mime types and excel

**URL:** <https://www.ruby-forum.com/t/respond-to-mime-types-and-excel/126285>\
**Category:** Rails\
**Created:** [January 16, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/respond-to-mime-types-and-excel/126285 "2008-01-16T23:43:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![binkly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b5e925/32.png) [@binkly](https://www.ruby-forum.com/u/binkly)\
**Post date:** [January 16, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/respond-to-mime-types-and-excel/126285/1 "2008-01-16T23:43:14Z")

</div>

Hello All,

I’m trying to figure out how respond\_to actually works, especially with  
the increased focus on REST.

After I set a MIME type for Excel

Mime::Type.register “application/vnd.ms-excel”, :xls

In my index action’s respond\_to block

I have format.xls {  
@parts = Part.find(:all)  
headers[‘Content-Type’] = “application/vnd.ms-excel”  
headers[‘Content-Disposition’] = “attachment;  
filename=“parts-inventory-#{Time.now.strftime(”%m-%d-%Y”)}.xls""  
headers[‘Cache-Control’] = ‘’  
render( :action=\>“inbound.rxml”, :layout =\> false)  
}

but how do i actually trigger the action to return the spreadsheet  
instead of the HTML page?

when i try index.xls it tries to render the show function.

If anyone can explain this that would be much appreciated.

Binh
