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
Jay GatsbyJay Gatsby 

Reading csv file from documents and insert master data to salesforce object using APEX

I have this requirement in my project, its called post refresh activity. We have refreshed our sandbox from production. Now we have 30+ master rescords to be inserted into sandbox, we can do it manually via, Dataloader/online Dataloader.io but its time consuming.

Now I want to make it automatic, like reading these csv files in apex class and insert data/records to respective objects. I have just overview of this, but i am not sure from where do i start.

It will be helpful if anyone can guide me little bit.

Thanks 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Jay,

So I found this below link that has an implementation of inserting records to object from csv via apex below is the link for the same:

>> https://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/#:~:text=In%20the%20example%20below%20we,CSV%20file%20for%20account%20objects.&text=Now%20we%20need%20to%20write,on%20'Import%20Account'%20button.

In case if this comes in handy can you please choose this as the best answer so that it can be used for others in the future.

Regards,
Anutej