Library › Coding AI › Teachers

Make a copy of a lab template for every student

Practice: Setting limits and rules. About 5 minutes.

About this exercise

Write a Google Apps Script function named makeLabCopies that reads student names from the Roster tab, column A from row 2 down, skipping blank rows, and makes one copy of the template doc (file ID 1LabTemplate4xYz) per student in the folder with ID 1Period3Folder, named exactly Lab 4 - <student name>. Don't share the copies or email anyone yet; you'll share them after checking. One code block, at most 12 lines, then under 25 words outside the code.

Common mistakes when you ask AI for this

  • Not saying where the names are. The AI reads the whole sheet, header and blank rows included, so you get a copy called Lab 4 - Student. Try: Add: "Roster column A from row 2, skip blanks."
  • Leaving the name open. The AI names copies its own way, like Copy of Lab 4. Try: Add: "Name each copy exactly Lab 4 - <student name>, in folder 1Period3Folder."
  • Not saying it's too early to share. The AI helpfully shares each doc with the student's email. Try: Add: "Don't share or email anything yet."
  • Getting a menu of options. The AI likes to offer two or three versions of the script, so you're left to pick and test them yourself. Try: Add: "Give one script only, in one code block, no alternatives."
  • Getting a tutorial. By default the AI explains every part of the code at length, which you then have to scroll past. Try: Add: "After the code, one line under 12 words. Nothing else."

What a strong prompt includes

  • Says where the names are
  • Gives the copy name
  • Gives the IDs
  • Rules out sharing
  • Caps the code length

Practice this now ↑

Related exercises