Slaesforce FAQ

how to pass csv to apex class salesforce

by Mr. Ryley Padberg Published 2 years ago Updated 2 years ago
image

To parse CSV to sObject using Apex in Salesforce, use the below link to get the code http://wiki.developerforce.com/page/Code_Samples#Parse_a_CSV_with_APEX Sample code: public List<List<String>> parseCSV (String contents,Boolean skipHeaders) {

Full Answer

How to export data from Visualforce to CSV file?

You can export data as CSV very easily, either using a report, or the data loader. download Apex Data Loader. there you get option to export and import the csv file. Thanks for your support, i know Data Loader, but i want to develop my visualForce page to export data.

Why you need to use apex?

Any reason you need to use Apex? You can export data as CSV very easily, either using a report, or the data loader. download Apex Data Loader. there you get option to export and import the csv file.

How to load CSVs from a page?

You could just use Data Loader to load CSVs, or even build a solution using the bulk API yourself. If you do need to do it from a page, I'd suggest that rather than splitting on a new line immediately, you use substring and the indexOf to pull just one line at a time from the input string, processing them as you go. Show activity on this post.

How good is the CSV parser?

The CSV parser is good in it. Inorder to meet the governer limits, I used all of the data into Maps and minimised the use of SOQL and DML statements. In your requirements, with a large data something like this, you can use batches to insert your data once you process it using CSV parser.

image

How do I export data from a csv file to Apex?

You can export data as CSV very easily, either using a report, or the data loader. download Apex Data Loader. there you get option to export and import the csv file. Thanks for your support, i know Data Loader, but i want to develop my visualForce page to export data.

How do I import a csv file into Salesforce?

To upload a CSV file, click on the Upload CSV button to select the file from your computer or drag and drop your file inside the import wizard. You can import files from your PC, Dropbox account, FTP, or SFTP connection.

How do you import a csv file into lightning component?

How to import records using Lighting Web Component?STEP 1: Upload data on an account object. Sample CSV File:STEP 2: Select the CSV File of account records and then Upload.STEP 3: Create ReadCSVFileInLWC.html.