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:
- Create the Group category with the name you specified
- Get a list of sections in a course along with the list of students in each section
- Create groups based off of those sections
- 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