Classroom Service

The Classroom service allows you to use the Google Classroom API in Apps Script. This API gives admins, teachers, and students the ability to view and manage their courses and rosters.

Reference

For detailed information on this service, see the reference documentation for the Classroom API. Like all advanced services in Apps Script, the Classroom service uses the same objects, methods, and parameters as the public API.

To report issues and find other support, see the Classroom support guide.

Sample code

The sample code below uses version 1 of the API.

List courses

This sample lists the first ten courses the user has access to.

advanced/classroom.gs
/**
 * Lists 10 course names and IDs.
 */
function listCourses() {
  var optionalArgs = {
    pageSize: 10,
  };
  var response = Classroom.Courses.list(optionalArgs);
  var courses = response.courses;
  if (courses && courses.length > 0) {
    for (i = 0; i < courses.length; i++) {
      var course = courses[i];
      Logger.log('%s (%s)', course.name, course.id);
    }
  } else {
    Logger.log('No courses found.');
  }
}

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.