The learning environment allows System Administrators to create multiple courses at once using a CSV file. This is particularly useful during the implementation phase, when you need to migrate courses from your old system to the Dual Code learning environment. In addition to creating new courses, the Upload Courses functionality may also be used to update or delete courses, or import content from another course.

To upload one or more courses:

  1. Go to Site Administration > Courses > Upload courses

  2. Either drag and drop the CSV file or click the 'Choose a file' button and select the file in the file picker

  3. Select appropriate import options carefully, then click the preview button.

NOTE: It is recommended that you use the "Preview" option to see if any errors were detected in the previewed rows. If you proceed with the upload and there were something wrong detected with a course, it will be ignored.

Valid Upload File for Testing

The text file to upload courses must be a CSV file. It can be created using Microsoft Excel or any other application, as long as it can be saved to a CSV format. Here is an example of a simple valid upload file.

shortname,fullname,category_path,summary
WHMIS,Workplace Hazardous Materials Information System,Classroom,This is my summary
Workplace Violence,Preventing Violence in the Workplace,Online,"This is my summary, with a comma"

Notice there are no spaces between the items. It is also very important to notice the last example (Workplace Violence) where the summary text is placed in quotation marks ("This is my summary, with a comma"). This is essential to ensure that the commas in the summary are not interpreted by the course upload tools as the end of a field. Be aware that quotation marks can be used to enclose some fields (such as fullname) but not others (such as shortname).

Creating the File for Import

The CSV file accepts the following columns which are divided in two categories, the course information, and the course actions.

Course Information Fields

Most of those settings are available on the settings page of a course. Please refer to course settings for more information. Field names must be lower-case.

Custom Fields

As of version 3.9, it is possible to include custom fields in courses. For example, a "duration" field is added by default to all installations so that an instructor can specify the expectation duration for a course. To upload information to custom fields, the convention is to add the word "customfield_" followed by the short name of the field.

For example, to upload the duration a course, the field name in the CSV file would be "customfield_duration". The field is simply a text field, so the value would be "1:00" for a 1 hour course. It is important that you follow this convention, which is HH:MM. Typing "1 hour" or "60 minutes" may result is display issues in certain reports and web pages.

Below are the conventions for uploading different file types.

Field Type

Field Name

Field Value

Sample Value

Additional Notes

Checkbox

customfield_[shortname]

0 = unchecked

1 = checked

1


Date and time

customfield_[shortname]

YYYY-MM-DD HH:MM

2021-06-28 14:00


Dropdown menu

customfield_[shortname]

Value of selection

10

The system does not verify / validate the value to see if it exists in the list of valid values for the field. In other words, if the list of valid values are 1-5 and you enter 10 in the CSV, the value of 10 will still be uploaded but you will not be able to see it when viewing the course information because "10" is not considered a valid value.

Also, the field is case sensitive. So if the valid values are A-Z and you enter lowercase a in the CSV, the value of a will still be uploaded but it will not be considered different than uppercase A.

Short text

customfield_[shortname]

Text

Hello World

If entering commas in your text, you must wrap the value in quotes.

HTML is NOT supported in this field.

Text area

customfield_[shortname]

Text

Hello World. Goodbye !!

If entering commas in your text, you must wrap the value in quotes.

HTML is supported in this field.

Enrolment Fields

Some fields can be constructed to enable and configure enrolment methods. The fields must be named enrolment_[number] for the enrolment method name, and enrolment_[number]_property for its properties.

Note: The "Upload courses" is not compatible with all enrolment methods.

The following is a sample excerpt from a file where you would want to enable "manual" registration but disable "self" registration.

shortname,enrolment_1,enrolment_1_role,enrolment_1_enrolperiod,enrolment_2,enrolment_2_disable
WHMIS,manual,student,1 month,self,1

Role Renaming

To rename some roles for a specific course, you can use the following pattern:

The following is a sample excerpt from a file where you would want to rename the student and teacher roles.

shortname,role_student,role_editingteacher
WHMIS,Apprentice,Master

NOTE: The short name for the teacher role is editingteacher and the short name for the non-editing teacher is teacher.

Course Action Fields

Mandatory Fields

Import options

To prevent unexpected behaviour, you have to specify what you want the tool to be able to do.

Course process

This allows you to specify actions to be taken for every course uploaded.

Default Course Values

Those are values that can be set in the web interface for all the fields that are not specified in the CSV file. Note that they are always used when creating a course, but only when specified during update (see Update mode).

Increasing Speed

When importing the content of a backup file, or another course, you are advised to enable the setting keeptempdirectoriesonbackup. This will considerably speed up the process of the upload if you are importing multiple times from the same source.