I have made a 4-line change to /admin/tool/uploadcourse/classes/helper.php (detailed below) that deals with uploading flat files. I've been modifying this file for years - since at least 2.6 - and it's worked every time. I think it's worth formally suggesting this modification to the core Moodle code since flat-file enrollment doesn't seem to be touched on much. How does one go about doing this?
For those interested, here's what it does:
The current flat-file upload process isn't very robust when it comes to categores: it requires categories to be created in Moodle before they can be used by flat files to upload courses. Flat files can only be added to existing categories as they use ID numbers of categories to assign the courses. I made this one minor change which tells Moodle if it receives a category name (not ID) to just go ahead and create the category so it can upload the course instead of failing to upload the course. (Otherwise you have to create categories in Moodle first and then import that data back to the SIS to then get the correct category IDs for each course, which is a burden to us.)
Here is the edit I made for anyone needing it for their own Moodle:
In /admin/tool/uploadcourse/classes/helper.php on line 465 and 466, comment out this part:
$id = -1;
break;
And add this code below it before the }
$a_new_category = coursecat::create($params);
$record = reset($records);
$id = $a_new_category->id;
$parent = $id;