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
DoanDoan 

Importing CSV file

I Build lightning web component to import csv file.
My lighnting web component reads data as text and sends the string to apex class.
Apex class parses the text and add records to a list. Can I insert 10000 records with apex. Does it hit any limits such as CPU time limit, Heap size limits etc? Is there any other suggestion to do this task?
Best Answer chosen by Doan
Nisar AhmadNisar Ahmad
Hi Doan

Yes, you will face some issues,
The size of the string is the only 6MB, so you have to split your CSV into several pieces and use a Batch Class and iterator to insert records.

You can try below link I hope it is helpful for you:
http://solution401.blogspot.com/2014/10/csv-file-data-process-in-salesforce-apex.html

I hope you find the above solution helpful. 

Thanks,

All Answers

Nisar AhmadNisar Ahmad
Hi Doan

Yes, you will face some issues,
The size of the string is the only 6MB, so you have to split your CSV into several pieces and use a Batch Class and iterator to insert records.

You can try below link I hope it is helpful for you:
http://solution401.blogspot.com/2014/10/csv-file-data-process-in-salesforce-apex.html

I hope you find the above solution helpful. 

Thanks,
This was selected as the best answer
DoanDoan
Hi Nisar, 

I tried your solution, but I encountered with another problem. I have a column which has newline "\n" character in it. When I try to import it recognizes it as a new row. Have you ever had such problem?