11

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.

1 Answer 1

13

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
  • 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, 2015 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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