Learn Google Apps Script
Apps Script Tutorials
googleappsscript.org is not specifically designed for teachers but has some very helpful tutorials to help you figure out those elements of your code you are trying to do. Remember to steal steal steal. I don’t generally code from scratch. I find other people’s code online, copy and paste it, and modify it.