问题
I am trying to grade a Google classroom of about 200 students and I have succeeded in grading each student on a .csv file. Is there a method that allows you to automatically fill and submit grades and comments on Google Classroom from a Google Sheet?
I have tried reading the .csv file and that works fine in a Python Script but writing the data to Google Classroom has been an issue.
回答1:
With the Classroom API you should be able to push grades to your Course if you have either the student IDs or student emails in the Google Classroom to match on. You can't, however, push comments.
The workflow for pushing grades would be as follows:
- If you don't have the Classroom course ID, retrieve it via the courses.list endpoint. Keep this handy for future use.
- With the Course ID from step 1, create a CourseWork item via the coursework.create function. You'll have to do this for each assignment you have. Make sure you keep the CourseWork IDs associated with each assignment for future reference.
- If you only have the student emails, you'll have to get their Classroom IDs with the students.get endpoint. This will also need the Course ID from step 1.
- Each CourseWork has a student submission object for each student, so you'll need to collect these student submission IDs for each student for the assignment. You can do this with the studentsubmissions.get endpoint.
- With each of these student submission IDs, push the student's grade for the given assignment with the studentsubmissions.patch endpoint. You'll need the course, coursework, and studentSubmission IDs to push this grade.
- Finally, return each of these grades with the studentsubmissions.return endpoint. Again, you'll need the course, coursework, and student submission IDs for this.
If you're using a spreadsheet, I imagine an example structure with all the data needed to do this would like as follows:
| Student Email | Student ID | Assignment 1 ID | Submission ID | Assignment 1 Grade |
| ------------- |:-------------:|:----------------:| ----------------:| ------------------ |
| Email 1 | student id 1 | courseWork 1 ID | submission 1 ID | grade #1 |
| Email 2 | student id 2 | courseWork 2 ID | submission 2 ID | grade #1 |
| ... | ... | ... | ... | ... |
Columns 3, 4, and 5 would repeat for each assignment you have. Documentation on how to write this code can be found here and here. If you're using Google Sheets, you can make an Apps Script to do all of this.
As for the comment functionality, again, we don't support that right now, but I encourage you to you can follow the reported feature request for updates here. I also recommend clicking “Me too!” at the top of the listed issue and posting any comments regarding your use case + need.
Hope this helps!
来源:https://stackoverflow.com/questions/56190614/grading-google-classroom-assignments-using-google-sheets