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
Abilash Kosigi 8Abilash Kosigi 8 

Dynamic CSV File loading into custom objects

I have two csv files with the following dummy data. Whenever, I upload it to the vf page, the apex class should read the first line
(which always contains the custom field names) and store the values in the next lines accordingly in the Account object. The number of of fields in the csv file can change time to time.
We can say that the template of the csv file is dynamic.


CSV File 1:

Account_no, Account_name, Account_branch, Account_City
100,Robert,Karlbagh,Delhi
200,Sam,Downtown,SanFransisco

CSV File 2:

Account_no,Accont_name,Account_city
400,Julie,London
500,Alia,Kolkata

Could anyone please help.
pconpcon
Do you have any code that you have used to attempt the solution?  Do you have any specific questions or issues you are running into while parsing the CSV or generating your Account objects to insert? Writing this code is not a trivial matter and not something that should be done by the people on this board and by people who do not have access to your org.
Vidhyasagaran MuralidharanVidhyasagaran Muralidharan
This could be helpful for your requirement
http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html