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
elyb527elyb527 

Worksheets in Excel

I am able to create an Excel file with data from Salesforce using a VF page.  I need to be able to put some data on Worksheet 1 and other data on Worksheet 2.  Is it possible to specify the worksheet?

 

If not, how would I do this?

 

Thanks for any ideas...

 

Ajay111Ajay111
You can specify a different format for a Visualforce page by using the ContentType attribute on the <apex:page> tag.
The ContentType attribute takes a Multipurpose Internet Mail Extension (MIME) media type as a value, such as
application/vnd.ms-works, audio/mpeg or image/gif. For more information about valid MIME media types, see
http://www.iana.org/assignments/media-types/.

To display this page in Excel, add the contentType attribute to the <apex:page> tag, as follows:
<apex:page standardController="Account" contenttype="application/vnd.ms-excel">
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!account.Contacts}" var="contact">
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
If the page does not display properly in Excel, try a different content-type, such as text/rtf.
elyb527elyb527
Thanks, I have that part working.  What I can't do in a VF page is create a second worksheet. I can do it in javascript and I think that is what I will wnd up doing. 
MaxFrielMaxFriel

Have you found a solution to this using visualforce?  I am looking to do the same thing

elyb527elyb527

No sorry.  The client doesn't use this functionality any longer so I didn;t do anything further.

rajesh_yrajesh_y

Hi  am also having same problem 

If you found solution please let me know

 

 

thank you