Library › Coding AI › Real estate agents
Turn a showings sheet into calendar events
Practice: Setting limits and rules. About 5 minutes.
About this exercise
Write a Google Apps Script function named addShowings that reads the Showings tab (header in row 1) and, for each row whose Scheduled column (E) is empty, creates a 30-minute event on the team calendar with ID showings@alderfinch.example, titled exactly Showing: <address> - <buyer>, starting at the date-time in C. Then write Yes in E. Don't invite or email anyone: no guests and no invites. One code block, at most 14 lines, then under 25 words outside the code.
Common mistakes when you ask AI for this
- Not naming the calendar. The AI uses your default calendar, so the team never sees the showings. Try: Add: "Use getCalendarById(\"showings@alderfinch.example\")."
- Forgetting what's already booked. The AI creates every row again each time you run it. Try: Add: "Only rows where E is empty, then write Yes in E."
- Not ruling out invites. The AI adds buyers as guests and sends invites, which they don't expect. Try: Add: "No guests, no invites, no email."
- 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
- Names the calendar
- Gives the title
- Skips booked rows
- Rules out invites
- Caps the code length
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)