Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 8 down vote accepted

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

share|improve this answer
    
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. – Shadowbob Jul 6 '15 at 9:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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