Flat file


The flat file enrolment plugin allows bulk enrolment management (enrol or unenrol) of existing users in existing course via a CSV file.

The file is processed by the Flat file enrolment sync scheduled task (new in Moodle 3.0; previously the legacy cron function was used) and then deleted.

The file should include action, role, user ID number, and course ID number; start time and end time are optional fields. Details of the file format are shown on the flat file settings page Site administration > Plugins > Enrolments > Flat file (CSV).

Enabling flat file enrolment

An administrator can enable flat file enrolment as follows:

  1. Go to Site administration > Plugins > Enrolments > Manage enrol plugins and click the eye icon opposite Flat file (CSV). When enabled, it will no longer be greyed out.
  2. Click the settings link, configure as required (see details of settings below), then click the 'Save changes' button.

File location

You should specify an absolute path for the upload file (eg /var/moodledata/enrolments.txt) where it can be read and modified by the web server process. The file is automatically deleted after processing.

File encoding

Make sure, you save the file (for example in a text editor) with the same encoding.


We can choose to have an email sent to notify the Administrator, Teachers and/or students when the file has been processed.

Unenrolment action

Any questions?

Please post in the Enrolment forum on moodle.org.

See also