Importing a CSV file every week


Every week I generate a csv with some clients via php, normally I use the option Import to a module to do that, and all works perfect, but what I want it’s to make this automatic, i.e, my php script generate a csv file every monday, so I want that my CRM import this data to the module I want every monday as well.
Is that possible?

I dont know if I explained correctly, ask me if you have any question about it.


It is similiar to this post:
Will say’s that this should be done with a custom script, but that post it’s from 1 year ago, maybe this functionality it’s implemented now.

There are two ways you could approach this, both include writing some code.

SuiteCRM has an API so you could add code to your script that generates the CSV to import the items to your CRM. There is a REST and a SOAP version of the API and you can find documentation here (change the first part of the url to the address of your CRM):

You could also create a custom scheduled task to import the CSV by adding a PHP file with the code you want to run in custom/Extension/modules/Schedulers/Ext/ScheduledTasks

You then need to add a nice label for it by adding a file to

and after that you will be able to set up when your scheduled task runs in your CRM’s admin.

The first option it’s giving me 404 Not Found error, so i’m going for the 2 option,“You could also create a custom scheduled task to import the CSV by adding a PHP file with the code you want to run in custom/Extension/modules/Schedulers/Ext/ScheduledTasks” that option, any guide or something about what to write in the code, because I don’t really know how to start :confused:

Thanks mate!

The url’s should definitely work, but the way I posted it possibly wasn’t very clear. Just add service/v4_1/rest.php or service/v4_1/soap.php?wsdl to the end of the url for your CRM. Or you can access it on our demo version of Suite here:

Regarding using the scheduled task, you need to create a PHP file in custom/Extension/modules/Schedulers/Ext/ScheduledTasks which looks something like this:

$job_strings[] = 'yourTaskName';

function yourTaskName(){
    // insert code to load file here

then you also need to add a PHP file so that SuiteCRM knows what name to display in the admin for your scheduled task. The file name should start en_us. and be located in custom/Extension/modules/Schedulers/Ext/Language/

It should look like this:


$mod_strings['LBL_YOURTASKNAME'] = 'Nice name to be displayed in admin';

After you do this run a repair and rebuild, then if you go to admin and scheduled tasks, then create a new task you can tell the CRM when you want this code to run.

Obviously in my example I’ve left out the basic code to actually load the data. I’m presuming you can change your script that generates the CSV to save it to somewhere the CRM can access and that you have the knowledge to write a script that reads the CSV so I’ll just give you an example of how to create a new Account and Contact and relate the two together (the same principle would work for any other module) which will hopefully be enough to get you started on writing the rest:

$newAccount = BeanFactory::getBean('Accounts');
$newAccount->name = "Example";
$newAccount->website = "";

$newContact = BeanFactory::getBean('Contacts');
$newContact->first_name = "Bob";
$newContact->last_name = "Smith";


1 Like

Wow thank you so much for that great answer!