function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Can we Export Excel sheet with more then one tab by VF page.or CRM???????????

Can we Export Excel sheet with more then one tab by VF page.or CRM???????????


I want to show more then one object's record in a Excel sheet with diffrent tab.


I am useing code..........


<apex:smileytongue:age standardController="Account" contenttype="application/">





Help me plz 


Thanks !!!!!!!


Hi Ajay111;

Fist I have to sa that I haven't heard about a tag like  <apex: smileytongue: age/> :smileyvery-happy:.


I don't know about tabs but you can generate several EXCEL sheets for different pages at the sametime by using

<apex:iframe  tag.


The outer page should be rendered as html.

<apex:page renderAs="html">

<apex:iframe src=""/>

<apex:iframe src=""/>



 In this method the pages vfPage1 and vfPage2 should have your contenttype="application/" attribute.

 Following is the vfPage1 and vfPage2.


<apex:page contenttype="application/">

Hello...I will be rendered as excel.










Thanks For reply prageeth,


it will download two files and i want just one file with two sheets.





I am looking to do the same thing. Ajay- did you figure out how to create multiple sheets in one excel file?


Has anyone found a solution to create Excel file with multiple sheets?




Apparently multiple sheets cannot be created in Salesforce using Apex+VF.

Can someone from Salesforce please confirm this so I can go back to the business and let them know so their requirements can change?  They want a visual force page that generates an Excel report with multiple sheets and from what I've researched this cannot be done (and no - I don't want to require my users to have any sort of Salesforce connectors installed locally on their machine to do this - and I don't want to use a 3rd party web service to generate this for me).  The requirement is a native Excel spreadsheet generated from Visual Force that has multiple sheets.

Neeraj GuptaNeeraj Gupta

Yes we can do this by rendering page as xml. Excel supports xml file type as well. 


Check my blog for code sample :


This code is not perfect you have to fix some minor sfdc issues as i have just copied it from my work and removed some object references.


Mark this issue as solved if this fulfil your requirement.




Madhura BMadhura B

Hi Neeraj,


Your Multisheet excel code snippet works great. Thanks for sharing.

could you please let me know how to export date and number fields please?


<Style ss:ID="s22">
          <Alignment ss:Vertical="Bottom" ss:WrapText="0"/>
          <NumberFormat ss:Format="Short Date"/>



 <Cell ss:StyleID="s22"><Data ss:Type="Date">{!e.Event_Date__c}</Data></Cell>

This isn't seem to be working and also I can't use <apex:outputText> here

Please suggest.

Vijaya Kumar RegantiVijaya Kumar Reganti
Hi Prageeth,

Can I apply the same concept for downloading multiple XML files ??

Soumok BasuSoumok Basu
Hi All
Is there any way to modify the code given by @Neeraj ? i need to add company logo(image) with that excel workssheet. 
Kt YadavKt Yadav
Hi ,
We can create multiple worksheets or tabs inside theexcel file using xml.Check the link where i have created two tabs inside same excel.