Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Visualforce CSV Example. Note the 'contentType' page attribute and the # to specify the file name.
This page must be accessed with an Account ID in the URL.
For example: https://<salesforceInstance>/apex/ContactsCsvPage?id=001D000000JRBet
<apex:page standardController='Account' contentType='application/'>
<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}'/>

This comment has been minimized.

Copy link
Owner Author

@douglascayers douglascayers commented Jan 2, 2017

Code snippet for my blog post about the many ways to export Salesforce data to CSV:


This comment has been minimized.

Copy link

@vyhenderson vyhenderson commented Dec 31, 2020

"contentType='application/". Excellent! It works! I appreciate your sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment