Automated Import (scheduled import of CSV)

Hi,

We’ve been using Gibbon for years. Starting as a solution for our Library, and a few other needs. It is not our main SIS, we need to use on of the “big guys”. :frowning:

We have also automated the export of data and automatically create CSV files that can be manually imported to Gibbon via Admin → System Admin → Import From File. This has been working well for a few years too.

I am now interested in automating this process. We have automated a lot through Clever. For others not support via Clever I have developed scripts to send data, for instance our “robo-call” system for emergencies. I was hoping that Gibbon had a similar automated import of CSV.

I looked at the Data Admin module. It sounded like it was still UI based. If I am mistaken or there is a way somewhere else, I’d love to hear about it. If not, are there are suggestions or warnings about trying to do one myself? Would it be bad to piggy-back on the existing UI pieces?

Thanks,
Ralph

Hi @rdegennaro great to hear you’ve been using Gibbon for so many years to meet various needs. It sounds like you’ve made some excellent custom solutions for yourself.

If you’re looking to skip the UI, my recommendation would be to make a CLI script (copying an existing one to get the basic structure of one) and then look at the modules/System Admin/import_run.php script, which handles both the UI and back-end part of the importing. There are separate Importer and ImportType classes which could be used to read and process the CSV data automatically. The following method calls are likely the most useful for your case:

// Line 438
$importSuccess = $importer->readCSVString($csvData);

// Line 445
$buildSuccess = $importer->buildTableData($importType, $columnOrder, $columnText);

// Line 449
$databaseSuccess = $importer->importIntoDatabase($importType, ($step == 4));

Hope this helps!

Hi @sandra , thanks for the pointers! As soon as I find time to concentrate the file looks quite helpful in figuring out how Gibbon works for importing. Thanks again!

-@rdegennaro

1 Like