+ Start a Discussion
iswarya sekar 7iswarya sekar 7 

How to export data from all objects using apex and save it in a folder?

SandhyaSandhya (Salesforce Developers) 

I would suggest you below blog which has the sample code for the same.

Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
iswarya sekar 7iswarya sekar 7
Hi Sandhya,

I saw this post. but I want to export all data from Salesforce in CSV format and it should be stored in a folder.
this is possible through Eclipse
iswarya sekar 7iswarya sekar 7
But I want this to be done using Apex.
Is there a reason you only want Apex solutions? What is the end goal? Are you wanting a full back up of your org in CSV? There are other options that are very powerful. I would recommend DemandTools (paid) or Jitterbit (free) for CSVs. Or if you are flexible and can use a database back up of your org, CopyStorm from CapStorm.

I think Sandhya actually provided a great link for your specific question. See point #7. It doesn't provide a full solution but gives building blocks.