Note: You are currently viewing documentation for Moodle 3.1. Up-to-date documentation for the latest stable version of Moodle is probably available here: Import groups.

Import groups: Difference between revisions

From MoodleDocs
(adding drag drop import of groups)
(adding users to groups)
 
(14 intermediate revisions by 9 users not shown)
Line 3: Line 3:


To import groups
To import groups
*Click the 'Import groups' button in ''Settings > Course administration > Users > Groups''
*Click the 'Import groups' button in ''Administration > Course administration > Users > Groups''
*Upload the CSV file (see below for file format) either by dragging and dropping into the box with the arrow (''1 below'') or by clicking "choose a file" and uploading from the [[File picker]]. (''2 below'')
*Upload the CSV file (see below for file format) either by dragging and dropping into the box with the arrow (''1 below'') or by clicking "choose a file" and uploading from the [[File picker]]. (''2 below'')


Line 19: Line 19:




'''Required fieldnames''' - These fields must be included in the first record, and defined for each user
'''Required fieldnames''' - These fields must be included in the first record, and defined for each column


  groupname
  groupname


'''Default fieldnames''' - These are optional - if they are not included then the values are taken from the current language and current course
'''Default fieldnames''' - These are optional - you may specify idnumber and/or course short name of another course


  idnumber, coursename, lang
  idnumber,coursename


'''Optional fieldnames'''
'''Optional fieldnames'''


  description, enrolmentkey, picture, hidepicture, groupidnumber
  groupidnumber,description,enrolmentkey


(Note: The field "picture" and "hidepicture" will produce a "not a valid fieldname" error when uploaded.)
If the ''groupingname'' is included, the imported groups will be allocated to those groupings. The groupings will be created if they do not already exist:
groupingname
*Separation between the comma and the text can not be a blank.
*Commas within the data should be encoded as &#44 - the script will automatically decode these back to commas.
*Commas within the data should be encoded as &#44 - the script will automatically decode these back to commas.
*For Boolean fields, use 0 for false and 1 for true.
*For Boolean fields, use 0 for false and 1 for true.
*Either idnumber or coursename can be used to identify the course. Idnumber overrides coursename. If neither is specified, the groups will be added to the current course.
*Either idnumber or coursename can be used to identify the course. Idnumber overrides coursename. If neither is specified, the groups will be added to the current course.
*Coursename is the course shortname.
*Coursename is the course shortname.
{{New features}}*Group ID numbers are for matching groups against external systems. Within a course, all group ID numbers must be unique.
*Group ID numbers are for matching groups against external systems. Within a course, all group ID numbers must be unique.
*The file must be in ANSI encoding, at least not be saved in UTF-8 encoding.


Note: If a group is already registered in the Moodle database for a particular course, this script will return the group name for that group. Teachers are only allowed to upload groups in courses they are authorized to edit.
Note: If a group is already registered in the Moodle database for a particular course, this script will return the group name for that group. Teachers are only allowed to upload groups in courses they are authorized to edit.
Line 43: Line 50:


<pre>
<pre>
groupname, description, enrolmentkey
groupname,description,groupidnumber,enrolmentkey
Team 1, Group Assignment Team 1, orange
Team 1,Group Assignment Team 1,team1,orange
Team 2, Group Assignment Team 2, purple
Team 2,Group Assignment Team 2,team2,purple
Team 3, Group Assignment Team 3, green
Team 3,Group Assignment Team 3,team3,green
</pre>
</pre>


Note that groups import doesn't currently handle anything to do with [[Groupings]].
===See also===
If you wish to add users to groups, you can do this as a site admin or manager from ''Site administration>Users>Accounts>Upload users''. See [[Upload users]] If the groups do not already exist, they will be created.


[[de:Gruppen importieren]]
[[de:Gruppen importieren]]
[[es:Importar grupos]]

Latest revision as of 08:30, 13 June 2015

Groups import provides a simple, easy way to create groups from a spreadsheet (CSV).

To import groups

  • Click the 'Import groups' button in Administration > Course administration > Users > Groups
  • Upload the CSV file (see below for file format) either by dragging and dropping into the box with the arrow (1 below) or by clicking "choose a file" and uploading from the File picker. (2 below)

newimportgroups.png

  • Click the 'Import groups' button

CSV file fieldnames

The CSV file has just one required fieldname (groupname), but can include default and/or optional fieldnames

  • Each line of the file contains one record
  • Each record is a series of data separated by commas
  • The first record of the file is special, and contains a list of fieldnames. This defines the format of the rest of the file.


Required fieldnames - These fields must be included in the first record, and defined for each column

groupname

Default fieldnames - These are optional - you may specify idnumber and/or course short name of another course

idnumber,coursename

Optional fieldnames

groupidnumber,description,enrolmentkey

(Note: The field "picture" and "hidepicture" will produce a "not a valid fieldname" error when uploaded.)

If the groupingname is included, the imported groups will be allocated to those groupings. The groupings will be created if they do not already exist:

groupingname
  • Separation between the comma and the text can not be a blank.
  • Commas within the data should be encoded as &#44 - the script will automatically decode these back to commas.
  • For Boolean fields, use 0 for false and 1 for true.
  • Either idnumber or coursename can be used to identify the course. Idnumber overrides coursename. If neither is specified, the groups will be added to the current course.
  • Coursename is the course shortname.
  • Group ID numbers are for matching groups against external systems. Within a course, all group ID numbers must be unique.
  • The file must be in ANSI encoding, at least not be saved in UTF-8 encoding.

Note: If a group is already registered in the Moodle database for a particular course, this script will return the group name for that group. Teachers are only allowed to upload groups in courses they are authorized to edit.


A sample file looks like this:

groupname,description,groupidnumber,enrolmentkey
Team 1,Group Assignment Team 1,team1,orange
Team 2,Group Assignment Team 2,team2,purple
Team 3,Group Assignment Team 3,team3,green

See also

If you wish to add users to groups, you can do this as a site admin or manager from Site administration>Users>Accounts>Upload users. See Upload users If the groups do not already exist, they will be created.