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
Swamy PSwamy P 

how to provide an option to export data into excel in an HTML email

Hello Everyone,

So far i'm sending data in email by html code using APEX. Now end user want to have an option to export data into excel from the HTML email.

How can we provide an option in the email to generate data in excel format? please provide your valuable thoughts.

Thanks in advance!!!
Medhya MahajanMedhya Mahajan
Hi, 

You can create a VF page that is used for exporting purspose, something like this sample page :
 
<apex:page standardController="Abc__c" extensions="Your_Contoller_Class" contentType="application/vnd.ms-excel#{!level} Your_File_Name.xls" cache="true">

Add your data to be displayed in the excel in this page. However remember that this Page will only contain data that you need to export to excel.
You can embed the link of this VF in your email.

Regards
Medhya Mahajan