'How can I assign multiple students to multiple rooms. with google app script

preparing classrooms in google, I have a spreadsheet with a database. in one of the columns is the identifier of the case or courseId and in another column I have the email address.

I have a script that identifies the id and email columns but I can't assign the student to each class.

function students() {
  const ss = SpreadsheetApp.getActive();
  var hoja_bd = ss.getSheetByName('I y II');
  var datos = hoja_bd.getDataRange().getDisplayValues();
  datos.shift();
  var ids = 7;
  var st = 12;
  datos.forEach(d => {
    var cursoId = d[ids];
    var estudiantes = d[st];
    //Logger.log (courseId + " - " + estudiantes)
    Classroom.Courses.Students.create({ "userId": estudiantes }, { "courseID": cursoId })
  })
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source