Sections to Groups Script

tyler_clair
Community Champion
3
1693

From a related post I was tagged in, the question was asked how to automatically create groups based off of sections in a course, Automatic Group creation for students in same section​. I took some time and wrote up a script in Python 3 that based off of a course ID and group category name it will do the following:

  1. Create the Group category with the name you specified
  2. Get a list of sections in a course along with the list of students in each section
  3. Create groups based off of those sections
  4. Create the membership for each student in the group

The one thing that this doesn't do is maintain the groups if a student enrolls in a course or if a student is moved to a different section. Those tasks will have to be done manually but when initially ran it will be fairly easy to make those small changes from within Canvas.

I have posted the code on my github page and it can be access here: https://github.com/tylerclair/canvas_admin_scripts/blob/master/sections_to_groups.py

3 Comments