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
RytomRytom 

Reading csv file from documents using APEX

I'm brand new to APEX and visualforce with background in Java. I was wondering if anyone could tell me the steps to take to be able to read a .csv file from APEX code. 

 

Basically, my application will read a .csv file which contains information pertaining to constants in an application. So I'm trying to write code that will parse through the csv file and populate class fields with data in the csv file. 

 

So far, I've uploaded the csv file into the Documents page, from there I'm not too sure what to do so that I can access the file from Documents and read it into something like a List/array. 

 

If anyone has any sample code or tips that would be greatly appreciated!

Samba GSamba G
RytomRytom

Do you have any suggestions or code samples on how to import the csv file? I'm not too sure how to even access the file in Documents so that I can play around with it. Most of the examples I found so far are just code on parsing the file.