Export the Excel file from Grid in Magento

In previous post export CSV, We have learn export CSV from admin grid now i am providing snipped of code to export excel from admin grid.
You can also check other tutorial of Magneto export,

/* @function         : exportExcelAction  
    * @created by       : parvez Alam  
    * @description      : Export purchased data grid to xml format  
    * @params           : null  
    * @returns          : array  
    */  
    public function exportExcelAction()  
    {  
        $fileName   = ‘purchasedTicket.xls’;  
        $content    = $this->getLayout()->createBlock(‘test_ticketpurchase_block_adminhtml_ticketpurchase_grid’);  
        //print_r($content->getXmlFile());die;  
        $this->_prepareDownloadResponse($fileName, $content->getExcelFile());  
    }