Batch Processing Users

moodleIf you want to upload a spreadsheet full of student user accounts to your Moodle site, this article will describe the procedure.


Create the Spreadsheet

You need to start by creating a correctly formatted spreadsheet to use.  A simple .csv file will work with the following headings:

firstname, lastname, email, username, password, course1
Steven, Pryer, This email address is being protected from spambots. You need JavaScript enabled to view it., stevenpryer, secret123, ART001
Lea, Pryer, This email address is being protected from spambots. You need JavaScript enabled to view it., leapryer, secret123, ART00

 This will add 2 new users, with an initial password, an enroll them as students on the ART001 course, where ART001 is the short course name.

 

firstname, lastname, email, username, password, course1, role1, course2, role2
Steven, Pryer, This email address is being protected from spambots. You need JavaScript enabled to view it., stevenpryer, secret123, ART001, teacher, CRAFT001, student
Lea, Pryer, This email address is being protected from spambots. You need JavaScript enabled to view it., leapryer, secret123, ART00, student, CRAFT001, student

This will also add new users, but now they can enroll in 2 different courses, and not just as students!  Note that you need to use the shortnames for roles (e.g. student, teacher, editingteacher, manager, coursecreator etc...).

 

Optional fields

Here are some more optional fields that you may find useful.

oldusername, deleted

Used for changing of usernames or deleting of users

course1, type1, role1, group1, enrolperiod1, course2, type2, role2, group2, enrolperiod2
  • course is the "shortname" of the course, if present the user will be enrolled in those courses.
  • type refers to the role to be used for associated course enrolment. Value 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.
  • You can use role field instead to specify roles directly - use either role short name or id (numeric names of roles are not supported).
  • Users may be also assigned to groups in course (group1 in course1, group2 in course2, etc.).
  • A group is identified by name or id (numeric group names are not supported)
  • You can set the enrolment duration, in days, for each course (enrolperiod1 for course1, enrolperiod2 for course2, etc.).

 

Upload Users

Start by logging on to your Moodle site, as an administrator.

  1. Go to Administration > Site Administration > Users > Accounts > Upload users.
  2. Here you can drag or drop your .csv file that you created.
  3. There are various options, here are some that I use:
    1. New User password: Field required in file.
    2. Force password change: All
  4. Now you can click Upload users.
  5. Click Continue.

 

Bulk User Actions

You may wish to send these new users an email confirming their login details.

  1. For Select for bulk user actions select All users.
  2. Click Continue to open the Bulk user actions page.
  3. With selected users, choose Send a message.
  4. Type your message, you can use html for formatting.
  5. Click Save changes.
  6. Click Yes to send.

 

Thanks for visiting.