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.


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

  • 1
    Wow this is great! I wondered why they were using xml all the time instead of xls, but never knew if they had Excel. Your reply gave me the answer. Thanks.
    – Shadoweb
    Jul 6 '15 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.