Creating course upload files

Prev Next

If you want to bulk upload courses to your site, you will need to create a CSV file.

Example file

The following example shows an upload file that sets the course short name, full name and category. There are no spaces between the items.

shortname,fullname,category
courserestored,Course restored,1
courserestored2,Course restored 2,1
courserestored3,Course restored 3,1
courserestored4,Course restored 4,1

The first row (shortname,fullname,category) sets out the column headings.

The first column in each subsequent row is the course short name. In this example, the course short names are courserestored, courserestored2, courserestored3 and courserestored4.

The second column is the course full name, which is displayed at the top of the course. In this example, the full names are Course restored, Course restored 2, Course restored 3 and Course restored 4.

The last column is the course category. This always uses the category ID rather than the category name. In this example, the category ID is 1, which is used for a category called Miscellaneous. The category name does not appear in the file, as only the category ID is used.

Categories must already exist before they can be used in a course upload. If the file contains a category ID that does not exist, the error Could not resolve category by ID is shown during the upload preview, and any courses in that category are not created.

Whatever other fields are included, the file requires the shortname and fullname fields, and one of the category, category_idnumber or category_path fields.

Course custom fields cannot be included in a course upload CSV file. Only the standard fields documented on this page are supported. Any custom field values must be set manually after the courses have been created.

Creating the text file

The course upload file must be a CSV file. The following columns can be used.

Course information fields

Most of these settings are also available in the course settings. Some settings are enabled or disabled using 1 (enabled) or 0 (disabled). This allows a setting to be enabled for some of the uploaded courses but not others. None of the fields controlled in this way are mandatory. To keep the default setting for all uploaded courses, leave the field out of the file.

Field names must be lowercase.

Field name

Description

fullname

The course full name.

shortname

The course short name.

idnumber

The course ID number.

category

The ID of the category in the Totara database. This takes precedence over category_idnumber and category_path.

category_idnumber

The ID number of the category to add the course to.

category_path

The full path of the category to add the course to. For example, to add the course to a subcategory called Machine Learning within a top-level category called Engineering, set category_path to Engineering / Machine Learning.

visible

If using traditional visibility, set to 1 to make the course visible, or 0 to hide it.

audiencevisible

If using audience-based visibility, set to 0 for enrolled users, 1 for enrolled users and selected audiences, 2 for all users, or 3 for no users.

startdate

The date the course starts, for example dd/mm/yyyy.

enddate

The date the course ends, for example dd/mm/yyyy.

summary

The course summary.

format

The course format. This must be a valid format that is enabled on the site. The standard format values are singleactivity (single activity), social (social), topics (topics) and weeks (weekly). Additional formats may be available if they have been installed and enabled on the site. When using singleactivity, include the activitytype field to set the activity the course uses. See the Activity types for the single activity format section below.

theme

The name of the theme the course is forced to use.

lang

The default language for the course.

newsitems

The number of news items to display in the news block, when used.

showgrades

Set to 1 to allow learners to view the gradebook, or 0 to hide the gradebook.

showreports

Set to 1 to enable activity reports, or 0 to hide them.

legacyfiles

Set to 1 to enable legacy course files, or 0 to leave them disabled (recommended).

maxbytes

The maximum upload size, in bytes, for files within the course. Set to 0 to use the site limit.

groupmode

The group mode for the course. Set to 0 for no groups, 1 for separate groups, or 2 for visible groups.

groupmodeforce

Set to 1 to force the group mode, or 0 to allow activities to choose the group mode.

enablecompletion

Set to 1 to enable completion tracking for trackable roles, or 0 to disable completion tracking.

completionstartonenrol

Set to 1 to start tracking completion when a user is first enrolled, or 0 to start tracking completion only when required by a trackable event.

coursetype

The course type. Set to 0 for e-learning, 1 for blended, or 2 for seminar.

tags

A comma-separated list of tags to add to the course.

Course action fields

These fields take precedence over the Course process parameters, which control what happens to the course, such as renaming, templates and resets.

Field name

Description

delete

Set to 1 to delete the course, if it exists.

rename

The new short name to give the course. The Allow renames setting must be enabled in the Import options settings.

backupfile

An absolute path to a backup file to import into the course.

templatecourse

The short name of a course to import content from.

reset

Set to 1 to reset the course during the upload, if it exists.

The following course attributes are not restored when uploading courses from a CSV file:

  • Course image

  • Icon

  • Collapsible sections

  • Section header colours

  • Completion progress tracking on view

  • Summary format

  • Calendar type

Renaming courses

The course upload can be used to rename courses in bulk. Include the new short name for each course in the rename field. For example:

shortname,fullname,category,rename
original-shortname,System Course 1,1,updated-shortname

Role renaming

Roles can be renamed in the uploaded courses. Use the format role_[shortname] for the column heading, and enter the new role name in the course row. For example:

role_student,role_editingteacher,role_teacher
padawan,master,jedi

This renames the Learner role (role_student) to padawan, the Editing Trainer role (role_editingteacher) to master, and the Trainer role (role_teacher) to jedi.

Field name

Description

role_*

Renames a role in the course, where * is the short name of the role.

Course format options

Field name

Description

numsections

The number of course sections. For the demo, topics and weeks formats only.

hiddensections

For the demo, topics and weeks formats only.

coursedisplay

For the demo, topics and weeks formats only.

numdiscussions

For the social format only.

activitytype

The activity used by a course in the single activity format. Use only when format is set to singleactivity. The value is the short name of the activity, for example quiz, scorm or facetoface. See the Activity types for the single activity format section below for the full list of values.

Activity types for the single activity format

When format is set to singleactivity, the activitytype field sets which activity the course uses. This is the same as selecting an activity in the Type of activity setting when creating a single activity course manually.

The following values can be used. The activity must be installed and enabled on the site.

Activity

activitytype value

Assignment

assign

Book

book

Certificate

certificate

Chat

chat

Choice

choice

Database

data

External tool

lti

Feedback

feedback

File

resource

Folder

folder

Forum

forum

Glossary

glossary

IMS content package

imscp

Lesson

lesson

Page

page

Quiz

quiz

SCORM package

scorm

Seminar

facetoface

Survey

survey

URL

url

Wiki

wiki

Workshop

workshop

Additional activity types may be available if they have been installed and enabled on the site. For an additional activity type, use the plugin name without the mod_ prefix. For example, an activity plugin named mod_example uses the value example.

Labels cannot be used, as a label does not have its own page.

For example:

shortname,fullname,category,format,activitytype
quiz101,Compliance quiz,1,singleactivity,quiz
scorm101,Fire safety,1,singleactivity,scorm
seminar101,Induction seminar,1,singleactivity,facetoface

Note: If the activitytype value is missing or not valid, no error is shown. The course is created using the default activity type set for the single activity course format.

Note: The upload sets the activity type but does not create the activity itself. The activity is added the first time the course is opened by a user with permission to edit the course.

Enrolment options

Enrolment methods can be added and configured using enrolment fields. Name the field for each enrolment method enrolment_[number], and name each of its properties enrolment_[number]_[property].

Field name

Description

enrolment_*_*

Sets enrolment options. The first wildcard (*) is a number identifying the enrolment instance, and the second is the name of the setting. The following settings can be used: delete, disable, startdate, enddate, enrolperiod, role, and other options provided by the enrolment method.

For example:

enrolment_1,enrolment_1_role,enrolment_2,enrolment_2_startdate
manual,learner,self,20170629

In this example, enrolment_1 is set to the manual enrolment method, with a default role of learner. enrolment_2 is set to the self-enrolment method, with an enrolment start date of 29 June 2017 (20170629).

These fields come after the mandatory shortname, fullname and category fields. A full example is:

shortname,fullname,category,enrolment_1,enrolment_1_role,enrolment_2,enrolment_2_startdate
courserestored,Course restored,1,manual,learner,self,20170629
courserestored2,Course restored 2,1,manual,learner,manual,20170530
courserestored3,Course restored 3,1,self,editingtrainer,self,20181212
courserestored4,Course restored 4,1,self,learner,manual,20180107

Upload courses is not yet compatible with all enrolment methods.

Notes about behaviour

When a backup file is provided, the course upload tool uses the restore functionality and does not turn on the Overwrite course configuration option. For this reason, settings such as completionprogressonview and numsections are not carried from the backup to the course. The tool does not force Overwrite course configuration, because some of the settings already come from the uploaded CSV file. Course settings are not taken from the backup unless the Overwrite course configuration option is selected.

When a backup is provided as a template for uploaded courses, the course settings are not taken from it. They must be provided in the CSV file, using the supported fields.

When a course backup file is restored as a new course, it restores as expected. However, when Restore into this course is selected from an existing course, the default restore settings are used. When the restore is complete, the existing course keeps its own settings (for example completionprogressonview) rather than taking those from the backup.

Join the Totara Community for more resources to help you get the most out of Totara. 


© Copyright 2025 Totara Learning Solutions. All rights reserved. Some content originally obtained via GPLv3 license and continues to be available under GPLv3. All other content is the sole copyright of Totara Learning Solutions.