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
AA 

How to write batch apex to add each batch records(200) to .csv file

Hi,

I'm writing a batch apex to delete records which are in lakhs.So before deleting them, i want all the records to be store in one .CSV(or .xls(Excel)) formate.

Let me know the code for this..

any help would be very much appreciated


Thanks
Ashish_SFDCAshish_SFDC
Hi , 


You have to add this code to your class, 

http://salesforceapexcodecorner.blogspot.in/2012/03/export-in-csv-and-excel-in-apex.html

http://www.chiragmehta.info/chirag/2010/04/06/how-to-export-data-to-csv-filetext-file-using-apex/


Regards,
Ashish