working with classroom
Code snippets to help you automate common tasks
Important note
Google Apps script can only be used to make changes that the user running the script has permission for. For example, the user can create or modify their own courses, but not those of other teachers. Or they can invite the guardians for students enrolled on one of their courses, but not for other students. On the subject of inviting — that is also usually the limit. So, students, teachers, guardians can be sent an invitation, but they can’t simply be added outright.
The exception to the above is when the user running the script has “administrator” privileges — then pretty much anything is possible! You should be very careful about running scripts using an admin account, though — you could accidentally delete your colleague’s course, for instance, or enroll every student in the school to the wrong course! All of the examples below assume that you are not using an admin account, and therefore focus on the user’s own courses and own students.
-
Automate guardian invitations

Use Apps Script to automate inviting guardians in Classroom using a list held in Google Sheets
-
Case study #1: Trigger an assignment from an email

A full script example to demonstrate posting an assignment to a course in Google Classroom using information taken from an email.
-
Sync student enrollment on a course

Use Apps Script to automate the syncing of students enrolled on a Classroom course with a list held in Google Sheets
-
Invite students to enrol on a course

Invite a Sheet-based list of students to enrol on a Google Classroom course.
-
List students enrolled on a course

Return a list of students enrolled on a course. You can use this to sync with an external list, to keep membership up to date.
-
Find the IDs of your courses

Quickly find the unique internal identifier for your Google Classroom course. You will need this to view or modify any course information.
Share this via: