{"id":"code-work-np-apps-script-thank-you-drafts","audience":"nonprofit","category":"coding","track":"coding","technique":"constraints","title":"Draft thank-you emails without sending them","free":false,"task":"Write a Google Apps Script function named draftThankYous that goes through the Gifts tab (header in row 1) and, for each row with Amount (C) of 100 or more and an empty Thanked column (E), creates a Gmail draft (never sends) to the email in B with the subject Thank you, <first name> from column A. Then it writes Draft into column E of that row. Body exactly: Thank you for your gift of $<amount> to Riverbend Food Share. One code block, at most 16 lines, then under 25 words outside the code.","materialLabel":"Gifts tab preview (attached to your prompt automatically)","material":"GIFTS tab - online gifts this week (row 1 is headers)\nA First name | B Email | C Amount | D Date | E Thanked\nAna | ana.mehta@mailbox.example | 250 | 11/02/2026 | \nTheo | theo.b@mailbox.example | 40 | 11/02/2026 | \nMarisol | marisol.vega@post.example | 100 | 11/03/2026 | Sent 11/04\nAiko | aiko.tanaka@post.example | 500 | 11/04/2026 | \nJae | jae.kim@inbox.example | 75 | 11/05/2026 | \n\nNotes from Grace (development):\n- Our director reads and personalizes every thank-you before it goes out.\n- Gifts under $100 get the automatic receipt only.\n- Board members are thanked by phone, not email.\n- About 30 online gifts a week this season.","rules":[{"type":"codeBlocks","count":1},{"type":"maxCodeLines","max":16},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Not saying draft, not send","why":"The AI sends the emails straight away, before the director can personalize them.","fix":"Add: \"Create drafts only, never send.\"","checks":["r0"]},{"title":"Leaving the rows vague","why":"The AI thanks everyone, including small gifts and people already thanked.","fix":"Add: \"Only Amount 100 or more and Thanked empty.\"","checks":["r1"]},{"title":"Not giving the wording","why":"The AI writes its own long thank-you and doesn't mark the row.","fix":"Give the exact subject and body, and say \"then write Draft in column E\".","checks":["r2"]},{"title":"Getting a menu of options","why":"The AI likes to offer two or three versions of the script, so you're left to pick and test them yourself.","fix":"Add: \"Give one script only, in one code block, no alternatives.\"","checks":["codeBlocks","maxCodeLines"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the code at length, which you then have to scroll past.","fix":"Add: \"After the code, one line under 12 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Says draft, not send","patterns":["draft","never send","don'?t send"]},{"label":"Sets which rows","patterns":["100","empty|blank","thanked"]},{"label":"Gives the wording","patterns":["thank you,","riverbend food share","subject"]},{"label":"Marks the row","patterns":["write draft","column e","mark"]},{"label":"Caps the code length","patterns":["\\d+\\s*lines","at most","under \\d+","short"]}],"hint":"A person reviews every thank-you first. Tell the AI that, which rows qualify, the exact wording, and how to mark the row.","rubricLabels":["Uses GmailApp.createDraft and never calls GmailApp.sendEmail or MailApp.sendEmail","Skips the header and drafts only rows where column C is 100 or more and column E is empty, so Marisol (already thanked) and Theo and Jae (under 100) get no draft","Uses the subject Thank you, <first name> and the exact body Thank you for your gift of $<amount> to Riverbend Food Share., then writes Draft into column E of each drafted row"]}