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
N@niN@ni 

how to export data to csv file using apex in visualforce page???

Hi,

In visualforce page i have one picklist which contains all the objects, and also i have one command button with the name 'Export', when ever we select the object name in picklist and click the export button it should export data for   that particular object in to csv file..

please help me.
Ramu_SFDCRamu_SFDC
The below article might give you an idea on this.

http://www.sfdcpoint.com/salesforce/export-excel-using-visualforce-page/
logontokartiklogontokartik
Hi, 

First before building the export, qq, what would be the size of records you would want to export? the reason I am asking is because there are various limitations for this kind of use case. Couple of them on top of my head

1. No of rows retrieved limit 
2. View State limit

If its handful of records, its easy, all you have to do is construct a SOQL query for the selected object and iterate to generate a comma separated String which can be rendered as text/csv in the Visualforce page. (using renderAs attribute)