Google Script Lesson 10 – Full-scale feedback

This is the full example that Stefan Muntwyler developed for his class at UNIS Hanoi, modified by both Stefan and Paul Swanson for demonstration purposes.Click here to view and then copy the spreadsheet.

Note that there are six functions in this script:

  1. onSubmit – this is what is triggered on form submission, and contains the main structure: build message, append message, send message
  2. buildMessage – this function uses a helper function, convertToList, to format the form response data and build a message out of it
  3. convertToList – this helper function takes the comma separated values and converts them into a nicely formatted list
  4. appendToDoc – this function opens up the student’s Google Doc and attaches the message to it
  5. emailStudent – this function creates an email based on the feedback message and then emails it to the student

The main function, onSubmit, does something that we haven’t see yet: it calls a function and then sets the RETURN value equal to a variable.
Just as you can pass parameters to a function, you can also RETURN values back to the original CALL. These return values can be set to variables, or can be used to call further methods, depending on the needs of the programmer.

THAT’S IT! Congratulations – you now have a fully functional Form/Sheet/Script system to automate your formative feedback with your students!

Leave a comment

Your email address will not be published. Required fields are marked *