General plugins (Local): CSV Enrolls & Groups plugin

Maintained by FredFred Woolard
Use this local plugin to import user enrollments and group assignments from a delimited text file into the course. New user accounts will not be created, so each of the users listed in the input file must already have an account set up in the site.
302 sites
20 fans
Current versions available: 4

The CSV Enrolls & Groups plugin allows you to import user enrollments for a course from an uploaded delimited text file. It is contributed by Fred Woolard.

Enrollments are made with the manual enrol plugin and using a selectable role. The plugin can optionally create course groups and assign the new enrollees to those groups.

Each of the users listed in the input file must have an existing Moodle user account; new Moodle user accounts will not be created.

This plugin was originally (Moodle 1.9) a refactor of the mass_enroll course admin mod done by Patrick Pollet and Valery Fremaux, using the standard groups course import plugin as a template. The current Moodle 2.x revision is again a refactor, but as a local plugin (placed into the local/ directory off the Moodle root), and accessed from the course administration menu under the 'Users' node.

Besides being able to create groups, you can select from existing groups and override the data file's group designation.


Screenshot #0


Fred Woolard (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Marc McLain
    Fri, Mar 25, 2016, 3:28 AM
    Hi Fred, I'm on Moodle 2.7 and am receiving the following error when I push the CSV file: "Unable to parse the line contents"

    The contents are by email. Would you happen to know why this issue is taking place?
  • Fred
    Fri, Mar 25, 2016, 3:45 AM
    Marc, there's likely a character I did not correctly account for in the email address. The regex pattern used for emails is:
    $regex_pattern = '/^"?\s*([a-z0-9][\w.%-]*@[a-z0-9][a-z0-9.-]{0,61}[a-z0-9]\.[a-z]{2,6})\s*"?(?:\s*[;,\t]\s*"?\s*([a-z0-9][\w\' .,&-]*))?\s*"?$/Ui';

    You test that pattern against your input file, or if you need help with that, you can message/email a sample email address entry from your file.
  • Picture of Sergey Churkin
    Mon, Aug 28, 2017, 4:29 PM
    Hi Fred! I have moodle v. 3.1.2 and instaled plugin, but it's not works. Have you a build of plugins for moodle v.3.1.2+ ?
  • Fred
    Mon, Aug 28, 2017, 8:04 PM
    Sergey... will respond to you with message.
  • Picture of Joyeux Eloise
    Wed, Sep 6, 2017, 5:43 PM
    Hi Fred! I also have a version 3.1 of moodle and we used the plugin in version 2.7. A version of the plugin for moodle v3.1 planned soon? ? Thank you in advance for your help !
  • Picture of Joseph Liaw
    Wed, Sep 13, 2017, 8:49 AM
    Hi Fred:
    Thanks for a FANTASTIC plugin that makes getting students enrolled and into groups into your courses! This also works fantastic for quickly creating groups for group assignments, and dovetails perfectly for the amazing Active Quiz plugin to quickly put your entire class into groups, and then allowing students to quickly self check-in who in their group is present for each session....

    Quick question: any chance you will be updating for Moodle 3.1 and 3.2 soon? Thanks for sharing your great work with the Moodle community!
  • Fred
    Fri, Sep 15, 2017, 9:59 PM
    Joyeux, and Josepth,

    Thank you both for your comments. The plugin version available on Moodle's download site should work on 3.1 or 3.2 without problem. There is a more current version on the github repository, however, please be forewarned that the current version removes functionality having to do with group assignments from metalink course enrollments. The functionality for group assignments from .csv file imports is still there.

    Because I do not know how many users would be impacted by removing the course metalink group assignment feature, I have not uploaded the current version to Moodle.
  • Picture of jon pullen
    Tue, Dec 5, 2017, 10:42 PM
    Hi Fred,

    Could you confirm that the ID Number field is limited to only numerical entries? (as the name suggests)
    Some of our users have alphanumeric IDs, causing the "unable to parse" message.

    Thanks in advance.
  • Fred
    Tue, Dec 5, 2017, 11:03 PM
    Jon, correct. The regex on line 218 of userenrols/lib.php controls, and can be edited if need be.
  • Andrew
    Wed, Feb 7, 2018, 12:26 AM
    Thanks for the plugin Fred. Would the new plugin version prevent me from grouping users already in a metacourse?
  • Fred
    Wed, Feb 7, 2018, 12:43 AM
    Andrew C, I removed that functionality (groups based on course meta link) because it was redundant, the feature is now available in the course meta link plugin. It does not prevent you from using the course meta link plugin 'Add to group' feature.
  • Picture of Mike Elliott
    Wed, Jul 25, 2018, 5:08 PM
    Hi Fred, Useful plugin- thanks! I can enrol people successfully using their usernames, but when I try and use email addresses I get a parsing error. Our company emails are a couple of subdomains deep, so I've replaced the regex with one that will match anything '/(.*?)'. I'm still getting the unable to parse error. Is there a way to fix this?
  • Fred
    Wed, Jul 25, 2018, 11:01 PM
    @MikeElliott, will send message.
  • myname
    Tue, Aug 28, 2018, 2:05 PM
    I have a question, I am using external DB plugin to enroll users
    if I use this plugin, does the enrolment method change from external DB to manual?
  • Fred
    Tue, Aug 28, 2018, 11:31 PM
    @moodle_question, this plugin will not change any existing user enrollments/roles they have in a course. If the user does not yet have a role in the course, it will add a manual enrollment for that user and make the specified role assignment. If the user already has a role in the course, no enrollment/role assignment will take place for that user; however, a group assignment may still take place if that is specified.
1 2
Please login to post comments