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
Anil MeghnathiAnil Meghnathi 

Want to Extract Data of Standard Object in a excel file using Apex class Coding

I Want to Extract Data of Standard Object in a excel file using Apex  class Coding.Using Visualforce page it is possible,but i want to get it through a Apex class.

 

Any idea???

 

Thanks 

anil

HariDineshHariDinesh

Hi,

 

Below VFP will load all the contacts to CSV file.

You need to specify which fields you want to load to Excel.

 

<apex:page standardcontroller="Contact" recordsetvar="Contacts" cache="true" contentType="text/plain/#test.csv">
Name,City
<apex:repeat value="{!Contacts}" var="con">
{!con.name},{!con.Email}
</apex:repeat>
</apex:page>
               

 

Just open this page like  /apex/pagename