CRMSalesforce CRM

Open Visual Force Page in Microsoft Excel

By December 27, 2020No Comments

Having a visual force page open in Microsoft Excel can come in handy for exports, reports, and merges.

When creating your visual force page, add the following to top <apex:page> section:

<apex:page standardController=”Contact” contentType=” application/ Example.xls” showHeader=”false” standardStylesheets=”false” > 

ContentType controls the application that will open the page.  Be sure to include showHeader = “false” and standardStylesheets=”false”.

Finally, add your page block section and return the values to the page (this code will list contact name, email, and phone for the household):


<apex:pageBlock title=”Contacts”>

<apex:pageBlockTable value=”{!account.Contacts}” var=”contact”>

<apex:column value=”{!contact.Name}”/>

<apex:column value=”{!contact.Email}”/>

<apex:column value=”{!contact.Phone}”/>




Test the page and see if it will open automatically in Excel (newer versions).  Otherwise it will download and then click to open it.  You may have to change the View and Enable editing.

Becci MG

Author Becci MG

More posts by Becci MG

Leave a Reply

Questions about Salesforce?

Email Gene directly at!