In my recent life, I was a teacher at an engineering school. For 7 years, I trained final-year engineering students in mobile application development. Aside from these lessons, what I enjoyed most was supervising and mentoring students in their final-year projects. But when it came to assessing and marking papers, that was another matter. After deploying Google Workspace for Education at the University of Yaoundé 1 during the COVID-19 period in 2020, apart from the issue of teaching that needed to be resolved, there was that of assessment. It should be noted that the University of Yaoundé 1 was, at that time, 8 institutions, including 4 faculties and 4 schools, including the National Polytechnic School of Yaoundé. More than 850,000 students and more than 500 teachers. Google Forms Assessment Quizzes were becoming an ideal solution for assessments, especially since we have teaching units attended by over 1,000 students in some faculties. It would be tedious for a teacher to mark 1,500 homework copies.
Problematic
In the context of an exam or general training assessment, you have developed a multiple-choice assessment quiz. Your quiz has more than 75 questions, and you find it tedious to manually copy each question and answer option into Google Forms. Did you know there is a way to automate this process?
This is the challenge we have tried to address to facilitate the production of interactive assessment quizzes for teachers at all institutions of the University of Yaoundé 1.
This article guides you step by step to transform your Google Docs document into an interactive, self-correcting quiz using Google Apps Script.
Why use Google Forms for your quizzes?
Google Forms is a powerful and free tool for creating quizzes and surveys. It offers many advantages:
- Ease of Use: Its intuitive interface allows you to create questions of various types (multiple choice, checkboxes, etc.) without advanced technical skills.
- Auto-Correction: By enabling « Quiz » mode, you can define correct answers and award points, allowing for automatic correction of assessments.
- Result Collection and Analysis: Responses are automatically saved to a Google Sheets spreadsheet, facilitating performance analysis.
- Customization: You can customize the appearance of your quiz with themes, images, and sections.
Automate Quiz Creation from a Google Doc: The Power of Google Apps Script
If you have a well-structured Google Docs document containing your questions, options, correct answers, and even explanations, Google Apps Script can save you valuable time by automating the creation of your quiz in Google Forms.
Prerequisites:
- A Google account with access to Google Drive (Google Docs and Google Forms).
- Minimal familiarity with the Google Apps Script interface (no programming experience is strictly necessary, but some computer skills are helpful).
- A clearly and consistently formatted Google Docs document for your quiz questions.
Format of your Google Docs document: The Key to Success
For the script to work properly, your Google Docs document must follow a specific structure. Here’s an example of the template used:
Formatting rules:
- Each question must begin with Question N:, where N is the question number.
- The question text follows on the next line.
- Answer options must be preceded by a capital letter (A, B, C, D, and sometimes E) followed by a period (.).
- The correct answer must be marked with (Correct) at the end of the option.
- An explanation (feedback) for the question must follow the options, preceded by the word « Explication » on a new line.
Google Apps Script Development: Step by Step
1. Open the Google Apps Script editor.
In your document menu, click « Extensions » > « Apps Script ».
2. Main Function and Access to the Document:
The script begins by defining a function named « creerQuizDepuisDoc() ». This is the function that will be executed. The following lines provide access to the active Google Docs document and its contents.
3. Creation of the Form and Activation of the Quiz:
Next, we create a new Google Form and enable quiz mode to allow grading and feedback.
4. Break the text into different questions:
We will use the split function to split the text into a table of questions following the formatting.
5. Processing of each Question:
Having already divided the text into a question table, all you have to do is take each question and process it. A question consists of two sections. The first concerns the question itself, the second concerns the explanation.
– Separation of the two sections:
– Processing the question:
The question consists of three parts: the question indicator, which is represented by “Question X:,” the question itself, and the answer options. Only the last two parts are important for our form. Therefore, we will split it online to eliminate the question indicator and create the question and answer options.
6. Identify Answer Options
We then look for lines that begin with a letter (A-E) followed by a « . » to identify answer options. We also check if the option is marked as correct.
7. Processing answer options and adding them to the form:
First, we’ll need to determine whether it’s a multiple-choice or single-choice question. Knowing this allows us to determine the appropriate element for our form (Multiple Choice or Checkbox). The rest is to add each option to our element (item) and indicate whether it’s the correct answer or not. Once we’ve finished adding the options, we set the question to quiz mode.
8. Processing of the Explanation (feedback):
Knowing that we already have our Explanation section, we just need to add it to the Item. We have opted to include the explanation both when the answer is correct and when it is incorrect. In my experience as a teacher, many students often check randomly when they have no idea of an answer. Being in a pedagogical logic, our primary concern is that everyone can understand the answer through the explanation.
9. Complete Final Code:
The final code is available at this link https://github.com/tlcyprien/doc2quiz
Running the Script:
- Save the script.
- Make sure the creerQuizDepuisDoc function is selected.
- Click the run icon (the « Play » triangle).
- Authorize the script if necessary.
Access Your New Google Form:
Once completed, a new Google Form will be created in your Google Drive.
Checking and setting up your quiz:
Open the created form and check the questions, options, correct answers, and feedback. You can also adjust the points and other form settings.
Conclusion: A Powerful Tool at Your Fingertips
With this detailed guide, you can now create your own interactive quizzes from Google Docs using the power of Google Apps Script. This process will save you time and allow you to focus on the quality of your assessment content.
For University of Yaoundé 1 teachers new to this solution, log in with your institutional account on Google Workspace and search for the Doc2Quiz app on the Google Workspace Marketplace.
Don’t forget to share your feedback with us.
PS: When running this application or script, you must select the correct answer for the first question. The rest is correct. This will prompt you to follow our recommendation to verify the form if it solves your problem.