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
Nihar SharmaNihar Sharma 

Importing Data in salesforce from external system using .csv file with FTP server

Dear All,

Here i have the requirement to use FTP server in salesforce..

-- we have one external system and data inserted into it day by day
-- after that at the end of the day one file(.csv) automatically generated to that external system
-- How can i access of that file(.csv) from external system in salesforce using FTP server
-- after having that file's data i need to insert that data automatically(scheduled) in salesforce which is coming from external system

How can i achieve this ?

Please suggest the way..

NagendraNagendra (Salesforce Developers) 
Hi Nihar,

1) You need proxy to access that file from salesforce by HttpRequest.

2) You can create scheduled job to check if there are unprocessed files by request, download that file, parse via apex and perform DML based on file content. 

Give a try with the above suggestions which should help you to accelerate with the above requirement.

Mark this as solved if it's resolved.

Best Regards,
Nihar SharmaNihar Sharma

Thanks.. i will go through your valuable suggestion...

Ya - there is no direct access to ftp from Apex.
Nihar SharmaNihar Sharma
Hi Nagendra,

Can you please tell me how to get the proxy access of that file..

i am going to refer this HttpRequest Class...

public class AuthCallout {
   public void basicAuthCallout(){
     HttpRequest req = new HttpRequest();
     // Specify the required user name and password to access the endpoint
     // As well as the header and header information
     String username = 'myname';
     String password = 'mypwd';
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     req.setHeader('Authorization', authorizationHeader);
     // Create a new http object to send the request object
     // A response object is generated as a result of the request  
     Http http = new Http();
     HTTPResponse res = http.send(req);

tell me where i need change and get that file and scheduled..

Shashank Gupta 96Shashank Gupta 96
Hi Nihar,
Did you find the solution? I am having the same requirement.
One of the possible way to import .csv files from FTP server to Salesforce is to use Skyvia ( It`s a no-coding data integration platform which requires minimal configuration. Jobs can be run manually or scheduled for automatic execution.
You can use below FTP API to integrate FTP server with Salesforce.

We have implemented a REST API which allow to directly communicate with an FTP server. This FTP API is designed for people who need to perform actions like DOWNLOAD, UPLOAD, DELETE and TRANSFER on the FTP server using REST API’s.

Blog Post:

If your problem have resolve, then mark this solution as a best answer and let me know if you need any other information.