Summary: Course upload allows not only the creation of course via a preconfigured CSV import file, but this process can also be used for bulk updates to existing courses.
Multiple courses can be created or updated in bulk within the LMS via upload. This process requires the use of a spreadsheet program to create a CSV file that will be uploaded to the site. There are many fields that can be included in the CSV file but only three fields are required: shortname, fullname, and category.
- shortname: The short, abbreviated name for the course. Required field for every operation except creating a new course.
- fullname: The full name of the course. Required field for a new course.
- One of category, category_idnumber, or category_path: This is the means of identifying the course category in which the course will be placed. Category is the system ID of the category, category_idnumber is the id number for the category that is manually assigned when editing a category, and category_path is the relative category path.
All field/column names must be lowercase, and each course must exist in a separate row in the file. The following fields should all be included in one file. Each tab has been separated according to topics to make it easier on administrators to know what field belong together and how each should be used.
Course Fields for CSV
Course Information Fields
For the CSV file, only three mandatory fields that must be included: the shortname, fullname, and category. Field names must be lower-case. The remaining available fields include the following. Most of these are setting values that are available on the settings page of a course.
| Course Information Fields | Description |
| shortname | The short name of the course. By default, this will be displayed in the breadcrumb navigation, and this value must be unique. |
| fullname | The full name of the course. This will be displayed in the course catalog. |
| category | This is one of the three possible means of identifying the category for the course (the other two are the "category_idnumber" or "category_path" columns). The "category" column should contain the system ID number of the category. This can be found by examining the URL field in the browser when the desired category is referenced. Data in this column will overrule any data in the "category_idnumber" and "category_path" columns for an individual course. Note, that while all three columns (category, category_idnumber, and category_path) can be used in the same import file, it is generally recommended that administrators choose one approach to identifying the category for course imports to reduce the potential for input errors. |
| category_idnumber | This is one of the three possible means of identifying the category for the course (the other two are the "category" or "category_path" columns). If ID numbers have been manually assigned to course categories, this column can be used to identify the manually assigned ID number of the category where the course is to be placed. The ID number field for a category is modified via the Edit category page for the desired category. Data in this column will take precedence over the "category_path" column but will be overruled by the "category" column for an individual course. |
| category_path | This is one of the three possible means of identifying the category for the course (the other two are the "category" or "category_idnumber" columns). This column should identify the path of the category to place the course in. For example, if the course is placed in the Training category under HR, the path should be HR / Training. Note the space between the forward slash that needs to be there [space] / [space]. Data in this column will be overruled by data in the the "category" or "category_idnumber" columns for an individual course. |
| visible | 1 if the course is visible, 0 if hidden |
| startdate | The time at which the course starts. |
| enddate | The time at which the course ends. |
| summary | The summary or description of the course. |
| format | The course format to use in the course. This must be a valid course format name. For example, weeks, topics, onetopic, grid, etc. |
| theme | The theme to use in the course. Note that course themes must be enabled in the administration options. |
| lang | The language to use in the course. Use the abbreviation of the language (e.g., en_us for American English) and the language pack must be installed. |
| newsitems | The number of news items to show. For example, 3 would indicate a default of three announcement posts in the course. |
| showgrades | 1 to show the gradebook to students, 0 to hide it. |
| showreports | 1 to show the activity reports, 0 to hide it. |
| legacyfiles | 1 to enable the legacy course files, 0 not to. |
| maxbytes | The maximum upload size of the course in bytes. Use 0 for the site limit. |
| groupmode | 0 for No groups, 1 for Separate groups and 2 for Visible groups. |
| groupmodeforce | 1 to force the group mode, otherwise enter 0. |
| enablecompletion | 1 to enable the activity completion, 0 not to. |
| audiencevisible | Course audience visibility can be set using the following: 0 for only visible to enrolled users, 1 for visible to enrolled users and members of selected audiences (audiences will need to be set manually), 2 for visible to all, and 3 for not visible. |
| coursetype | The course type can be set using the following: 0 for e-learning, 1 for blended, and 2 for face to face/seminar. By default, the value for coursetype is E-learning. This is only for the scenario where the coursetype field is missing from the CSV file or the field is empty. |
| tags | A comma-separated list of tags to add to the course. Existing tags will be deleted. Enclose multiple tags in quotes. |
| delete | 1 to delete the course. |
| rename | If updating the course, this put the original short name in the shortname field and its new name in the rename field. |
| backupfile | An absolute path to a backup file (.mbz) to import in the course. This means the full path to your course, for example /home/yourmoodle/public_html/totara12/transfer/backup.mbz . If unsure of where the path is, look at include_path in ► Server ► PHP info. |
| templatecourse | The short name of a course to import the content from. |
| reset | 1 to reset the course. |
| role_[shortname] | The new name of the role [shortname]. For example, role_student: Apprentice. |
Enrollment Fields
The following fields can be constructed to enable and configure enrollment methods. The fields must be named enrolment_[number] for the enrolment method name, and enrolment_[number]_property for its properties. For example, enrolment_1: manual, enrolment_1_role: student, enrolment_1_period: 1 month, enrolment_2: self, enrolment_2_startdate: 2019-01-19.
| Enrollment Field Names | Description |
| enrolment_[number] | The name of the enrolment method (eg, manual, guest, self). |
| enrolment_[number]_delete | 1 to delete this enrolment method from the course, if set to 1 all the other properties will be ignored. |
| enrolment_[number]_disable | 1 to disable this enrolment method from the course, if set to 1 all the other properties will be ignored. |
| enrolment_[number]_startdate | The enrolment start date. For example, 2019-01-19 will put the enrollment start date at January 19th, 2019. |
| enrolment_[number]_enddate | The enrolment end date. For example, 2019-05-10 will put the enrollment start date at May 10th, 2019. |
| enrolment_[number]_enrolperiod | Number of seconds, or if not a value understood by strtotime() such as "4 days". |
| enrolment_[number]_role | The role short name. |
| enrolment_[number]_[property] | Where property is understood by the specified enrollment method. |
| enrolment_[number]_password | The course enrollment key. |
Upload Course Options
To create courses using a comma-separated values (CSV) file, follow these instructions.
Open the Site Administration menu and navigate to Courses and categories page ► Courses block ► Upload courses.
General settings
On the Upload Courses page, either drag the CSV file to the File box or select Choose a file to open the file picker and search for the file.
Change any of the general settings as required:
- If the CSV file uses a different delimiter to separate fields other than a comma, select that value from the CSV delimiter list.
- If the CSV file has been encoded in a method other than "UTF-8," select the method from the Encoding list.
- Select how many rows to preview in the Preview rows list. The courses previewed will present system checks for any errors within the CSV file.
Learning Pool recommends keeping the defaults that are already set and formatting your CSV file to match those defaults.
Import Options
Configure the appropriate options in the Import options section:
Upload mode: This specifies how the system should handle the CSV file in terms of creating courses and/or updating courses. There are four options to choose:
- "Create new courses only, skip existing ones": Any new courses found in the CSV file will be created. If existing courses are found in the CSV file, those will be ignored.
- "Create all, increment shortname if needed": This will create all courses listed in the CSV file regardless if they are new or existing. If they are existing, the system will rename the shortname for the existing courses through an incrementing system by adding a _X to the end to make it unique. For example, if an existing shortname was stats-101, the system will name the new shortname stats-101_1.
- "Create new courses, or update existing ones": Where a course in the CSV file has the same shortname as an existing course the settings are updated to match the file, new courses are created.
- "Only update existing courses": Where a course in the CSV file has the same shortname as an existing course the settings are updated to match the file, new courses are skipped.
The following options are available if the following Upload mode options are used, "Create new courses, or update existing ones" or "Only update existing courses in the Upload Mode."
- Update mode: This option determines what source to use to update the course. There are four options to choose:
- "No changes": This option will keep the courses the same and will not update them with data in the CSV file or defaults.
- "Update with CSV data only: This will update the courses with data in the CSV file only. Default data will be ignored.
- "Update with CSV data and defaults": This will update the courses with data from both the CSV file and defaults. CSV fields will take precedent, but if blank, then values from the defaults will be used. Any fields left blank from both the CSV file and defaults will be ignored.
- "Fill in missing items from CSV data and defaults": If the field is empty, then it would use data from the CSV and defaults to fill in the field. CSV fields will take precedent, but if blank, then values from the defaults will be used.
- Allow deletes: Whether the delete field is accepted or not in the CSV file. This option deletes the course from the system.
- Allow renames: Whether the rename field is accepted or not in the CSV file. This option renames the course in the system.
- Allow resets: Whether the reset field is accepted or not in the CSV file. This option resets the course and deletes all user activities and course completion records.
Preview Page
The Upload courses preview page will list all the courses that will be created and/or updated in the system.
The Result column will indicate if the upload will be successful and that will be indicated by either a for success or a for failure with a reason for each failure in the Status column.
The Import options are the same as the previous screen. This gives administrators a chance to adjust the settings if there are errors in the course preview table.
Course Process
In the Course process section, there are four options available:
- Template to generate a shortname: The shortname column must be in the CSV file, but if values are left blank, use this to generate unique shortnames for new courses created. Template syntax may be used. For example, %f will use the courses fullname as part of the course's shortname and %i will use the ID number for the course.
- Restore from this file after upload: Use the File box to drag-and-drop a backup file to use as a template for new courses created.
- Restore from this course after upload: Similar to the previous option, this one will use an existing course in the LMS as a template to populate new courses.
- Reset course after upload: This tells the system to reset the course and erase any user data that might be associated with the template.
Default Course Values
In the Default course values section, configure the following options if the following Upload mode is set, "Create new courses, or update existing ones" or "Only update existing course." The following options will only update if those values are not included in the CSV file.
- Course category: This setting determines the category in which the course will appear in the list of courses.
- Audience-based visibility: This setting determines whether the course, program or certification appears in the corresponding list. If "Enrolled users only" and "Enrolled users members of the selected audiences" is selected then it will be visible to all members of the assigned audiences. Users that are enrolled will be able to see it, no matter what visibility setting is selected.
- Course start date: This setting determines the start of the first week for a course in the weekly format. It also determines the earliest date that logs of course activities. If the course is reset and the course start date changed, all dates in the course will be moved in relation to the new start date.
- Course end date: The course end date is only used for reports. Users can still enter the course after the end date.
- Format: The course format determines the layout of the course page.
- Force theme: This changes the theme for the course only if course themes are enabled on the system level.
- Force language : This will force whatever language is chosen when users enter the course.
- Number of announcements: This setting determines how many recent announcements appear in the latest announcements block.
- Show gradebook to learners: Many activities in the course allow grades to be set. This setting determines whether a learner can view a list of all their grades for the course via a grades link in the course administration block.
- Show activity reports: This setting determines whether a learner's activity reports are shown when viewing course profiles listed on their user account profile page. These reports display the learner's contributions such as forum posts, assignment submissions and include access logs.
- Maximum upload size: This setting determines the largest size of a file that can be uploaded to the course, limited by the site-wide setting set by an administrator. Activity modules also include a maximum upload size setting for further restricting the file size.
- Group mode: The group mode defined at course level is the default mode for all activities within the course. Each activity that supports groups can also define its own group mode, though if the group mode is forced at the course level, the group mode setting for each activity is ignored.
- Force group mode: If group mode is forced, then the course group mode is applied to every activity in the course. Group mode settings in each activity are then ignored.
- Enable completion tracking: If enabled, activity completion conditions may be set in the activity settings and/or course completion conditions may be set.