Flat File Enrollment and Groups

Picture of Ryan Sullivan
Flat File Enrollment and Groups


I'm trying to figure out how to use flat file enrollment and also include students in groups in their courses. We're currently using Moodle 3.3. I'm currently using the flat file enrollment sync scheduled task to manage students. 

Teachers are wanting their students grouped based on the hour they are enrolled in. I can get the information from our student information system - I just need to figure out how to get that into the flat file in a way Moodle can read it and act appropriately. 

Currently, our flat file looks like this:


Can I somehow append the group to this in a way that is readable? Or should I use a different enrollment method?

Thanks for any info provided

Average of ratings: -
John Provasnik at Moodle Moot US
Re: Flat File Enrollment and Groups
Particularly helpful Moodlers

I too am looking for a way to add groups through Flat File (because Flat File alerts teachers of the course of the new enrollments). I don't believe it's possible to enroll in groups through Flat File method. 

CSV Upload (directly through the Moodle interface) allows for enrollment into groups or cohorts.

Average of ratings: -
Picture of Sara Arjona Téllez
Re: Flat File Enrollment and Groups
Core developersMoodle HQParticularly helpful MoodlersPlugin developersTesters

Hello Ryan and John!

At the moment, as you suspect, it's not possible to specify the group in the flat file enrollment.

I just created a tracker issue and I'm just noting the number here - MDL-60800. In the meantime feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please let us know, adding the "patch" label to the issue, so we will spot it. 

Please, don't forget to watch the issue to get updates wink

Average of ratings: Useful (2)
Picture of Ed Beck
Re: Flat File Enrollment and Groups

A low tech workaround could be to use the CSV uploader to create a Moodle course for each section or hour of the class.

Then you could use Course Meta linking to sync enrollment between your dummy shells and the course you originally wanted to get them in any way. That's what most Universities do when linking between large SIS and automatically generated courses.

An alternative that does a little more of the work for you is the Database Enrolment option because you can configure that to automatically generate the courses for you as well enrolling the users. 

Using either of those methods, a teacher with five sections would have a Moodle Course Shell for each one of their classes. Then you would use one of the shells (or create a new one) to be the META shell. Using meta enrolments, anyone who was enrolled in one course would be automatically enrolled in the other. You can set it up so that when a student is enroled in the new META course, they are automatically also put in a group with their classmates.

Finally tell your teachers to hide from students the individual hour shells that they are not using. They will be on the Teachers dashboard, but it will keep it out of the way of the students. 

Pro tip: if you set a course end date in the past, they will flip over to the Past tab of your dashboard so that it is out of sight and out of mind for your faculty. You can create a template course that new courses will automatically be generated from so that it is done seamlessly in the background.

Average of ratings: -
Re: Flat File Enrollment and Groups
Particularly helpful Moodlers

If "groups" cannot be created using Flat File Enrollment ... an alternative may be Site Admin > Bulk User Actions > Upload Users (via csv).

  • We have used Bulk user upload CSVs to create user accounts; enrol into courses and add to groups as needed.
  • Another alternative plugin that allows teachers to bulk enrol and add groups is the CSV Enrol and Groups https://moodle.org/plugins/local_userenrols


Average of ratings: -
Picture of Emma Richardson
Re: Flat File Enrollment and Groups
Documentation writersParticularly helpful MoodlersPlugin developers

If you could map that field to the Institution field or something similar you could use the auto group plugin to automatically group them.  I am attaching the latest version which is working correctly through version 3.4.  The one in the plugins database is an older version.  I have asked the developer to upload the last version but I have it so have included it.

Average of ratings: Useful (1)