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.

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. ... Step 4: CSV File LWC. Js-meta. ... Step 5: ReadCSVFileInLWC.js. ... Step 6: Apex Class(CSVFileReadLWCCntrl)
Can we read Excel file in Apex Salesforce?
First Salesforce does not read the excel file into apex. To overcome for this either we can covert excel file to CSV and import csv file using below code. And We can import data using data loader But sometime there is requirement when end users do not want to use Apex Data loader.
How do I use Apex data Loader?
Open the Data Loader.Click Insert, Update, Upsert, Delete, or Hard Delete. ... Enter your Salesforce username and password. ... Choose an object. ... To select your CSV file, click Browse. ... Click Next. ... If you are performing an upsert, your CSV file must contain a column of ID values for matching against existing records.More items...
How do I import bulk data into Salesforce?
Use the Data Import WizardStart the wizard. From Setup, enter Data Import Wizard in the Quick Find box, then select Data Import Wizard. ... Choose the data that you want to import. ... Map your data fields to Salesforce data fields. ... Review and start your import. ... Check import status.
How do I upload files to Salesforce lightning?
In Lightning Experience Click Add Files in the Files related list menu, or drag files directly onto the Files related list. (You can drag multiple files, but not a folder. You can't drag files onto read-only related lists.) Note In Lightning Experience, your org may use a custom page layout for the file detail page.
How do I use lightning files to upload?
To upload files using lightning-file-upload , you can:Select a file on your system by clicking the button to open the system's file browser.Drag a file from your system into the file selector dropzone.
How do I import a flow into Salesforce?
Import a FlowSelect Setup> Process Automation> Flows.Select Import/Export Flows.Run the Flow.Select Import then click on Upload Files.Pick the Flow file from your computer's file dialog box. ... After the file has been uploaded, select Done then click Next.More items...
How do I read a CSV file from a static resource in salesforce?
Load data stored in Static ResourcesStep 1: Create CSV files with your data and upload them to Static Resources. ... Step 2: Create a CSV Reader class. ... Step 3: Adapt and run the following Anonymous Script on your Sandbox.
How do I convert Excel to CSV in Salesforce?
Convert XLS to CSVOpen the Import file. This can be done through a spreadsheet software such as Microsoft Excel or Google Sheets, but can also be done in TextEdit (Mac) or Notepad (Windows)Select File.Click Save As.Rename the file if you prefer then select . csv (Comma delimited.)Click Save.
How do I create an apex file from Excel?
It takes 3 steps to add SpreadJS to an APEX application page and implement Excel file importing and exporting capabilities: Add Script and CSS SpreadJS files....Download now!Step 1: Add Script and CSS SpreadJS files. ... Step 2: Set up APEX page. ... Step 3: Initialize SpreadJS and the Excel IO module.