Within a Classroom, an assignment has been created that contains a Sheet, which each student has a copy. I am trying to find a way, within the GAS bound to the sheet, to determine which Classroom course the Sheet was opened from.
The template Sheet that I am developing may be used in many Classrooms and by many students. I have got the file id from using the onOpen trigger:
function onOpen(e) {
let fileId = e.source.getId()
... //Store fileId in Sheet for later use
}
but I’m at a loss as to work backwards to find the Classroom it came from.
I thought that I could use DriveApp to find the file by its id, and thus the course name from the file’s parent, from within the onOpen trigger but, apparently, code that requires authorisation is not permitted in a simple trigger. I created an installable trigger which allows such access but I can’t find a way of binding the installable trigger to the Sheet so that it is in the Student’s copy of the Sheet.
So, how do I find that course the spreadsheet came from? Is there some data I’m missing that could help?
Any help would be much appreciated.
David Lee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.