Create & Manage a Course Using a CSV Text File
This article is about creating and managing courses with a text (.csv) file using the Upload courses functionality of Lambda Learn (Moodle).
Creating the Text File
The text file to upload courses must be a CSV file. It accepts the following columns which are divided in two categories:
- Course Information Fields
- Course Action Fields
COURSE INFORMATION FIELDS
Most of these settings are available on the settings page of a course. Please refer to Course settings for more information. Field names must be lower-case.
The following are the required fields when using a CSV text file to create and manage courses.
- shortname This field is mandatory for every operation, with the only exception of creating new courses.
- fullname Required when creating a new course.
- category, category_idnumber, category_path One of these is required when creating a course.
Course Information Fields
||The full name
||The course ID
||This is the ID of the category to place the course in. This takes precedence over category_idnumber and category_path.
||The ID number of the category to place the course in (found in the category url). This takes precedence over category_path.
||The path of the category to place the course in. If you want to place the course in a category named "Science-Fiction" which is located under the category "Movies", the value to provide is:
Movies / Science-Fiction
. Note that the separator must be
. Also note that the category MUST exist, it will not be created. If you want to place the course in the top-level category "Movies", the value to provide is:
||1 if the course is visible, 0 if hidden
The time at which the course starts.
Please note that this value is passed to the PHP function strtotime to generate a timestamp. Example 01.12.2014 (1st December 2014)
The time at which the course ends.
Please note as with startdate that this value is passed to the PHP function strtotime to generate a timestamp. Example 01.12.2014 (1st December 2014)
||The summary of the course
||The course format to use, this must be a valid course format plugin name. E.g. weeks, topics.
||The theme to use
||The language to use
||The number of news items
||1 to show the gradebook to students, 0 to hide it.
||1 to show the activity reports, 0 to hide it.
||1 to enable the legacy course files, 0 not to.
||The maximum upload size of the course in bytes. Use 0 for the site limit.
||0 for No groups, 1 for Separate groups and 2 for Visible groups.
||1 to force the group mode, otherwise enter 0.
||1 to enable the activity completion, 0 not to.
||A comma-separated list of tags to add to the course. Existing tags will be deleted. Enclose multiple tags in quotes.
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.
||The name of the enrolment method (eg, manual, guest, self)
||1 to delete this enrolment method from the course, if set to 1 all the other properties will be ignored.
||1 to disable this enrolment method from the course, if set to 1 all the other properties will be ignored.
||The enrolment start date. This value is passed to the PHP function strtotime().
||The enrolment end date. This value is passed to the PHP function strtotime().
||Number of seconds, or if not a value understood by strtotime() such as "4 days".
||The role short name
||Where property is understood by the specified enrolment method
||The course enrolment key
enrolment_1_enrolperiod: 1 month
To rename some roles, using the following pattern:
role_[shortname]The new name of the role [shortname].
It is worth noting that the short name for the teacher role is editingteacher and the short name for the non-editing teacher is teacher.
COURSE ACTION FIELDS
Those settings take precedence over the Course process parameters.
||1 to delete the course.
||The shortname to rename the course to.
||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/moodle27/transfert/backup.mbz . If you are unsure of this, look at include_path in Site administration>Server>PHP info.)
||The short name of a course to import the content from.
||1 to reset the course.
To prevent unexpected behaviour, you have to specify what you want the tool to be able to do.
Upload modeThis allows you to specify if courses can be created and/or updated.
Update modeIf you allow courses to be updated, you also have to tell the tool what to update the courses with.
Allow deletesWhether the delete field is accepted or not
Allow renamesWhether the rename field is accepted or not
Allow resetsWhether the reset field is accepted or not
This allows you to specify actions to be taken for every course uploaded.
Shortname templateIf you are creating courses without a shortname, you can use this field to automatically generate a shortname. This field accepts two placeholders: %i for the ID number, %f for the summary.Restore fileA backup file (.mbz) to import in the course after create/update.Restore from courseThe shortname of a course to import content from after create/update.Reset after uploadWhether to reset the course after creating/updating it.