Magento 1.8 – How to Export Custom Grid Data to XLS

exportmagento-1.8

How to export my custom grid data's in xls format in Magento Admin panel grid.

In default we having the csv and xml format.

enter image description here

Anyone help me on it.

Best Answer

Try this below code:

$this->addExportType('*/*/exportExcel', Mage::helper('{module}')->__('Excel'));
public function exportExcelAction()  
{  
    $fileName   = 'excel_name.xls';
    $content    = $this->getLayout()->createBlock('{module}/adminhtml_{module}_grid')->getExcelFile();
    $this->_prepareDownloadResponse($fileName, $content);  
}  

also refer here