Personal Appointment and Reminder Manager
Upcoming appointments can be overlooked.
What this teaches
List appointments in next seven days from demo date 2026-11-25. Family schedules, personal appointments and service bookings.
Start without an account in the local application. Read/edit the input, predict a result, run the current source and verify output. A local document preview is not a real Google Doc; a fixture is not a live model response.
Input and expected result
Input tab: Appointments. Entry function: showAppointments().
| Title | Date | Time |
|---|---|---|
| Dentist | 2026-11-26 | 10:00 |
| Car service | 2026-12-10 | 09:00 |
Expected baseline: Dentist only
Exact Workspace setup
- Download and unzip this project. Use one separate bound script per lesson.
- Create a dedicated Drive folder. Create a native Google Sheet inside it, and import starter.csv into a tab named Appointments. Check the exact headers above.
- Open the Sheet → Extensions → Apps Script. Paste finished Code.gs into the script editor. Save.
- Choose showAppointments in the function selector → Run. Review actual requested permissions. Reload the Sheet for the Workshop menu.
- Compare output with the baseline above. Check generated documents/drafts manually. No email should be sent.
- Perform the original challenge, investigate a failure and test duplicate/partial runs before scheduling. Do not install a trigger just because one manual run succeeded.
Understand the implementation
Filter ISO dates between inclusive start and exclusive end; sort by date.
Key operations: getValues(); JavaScript transformations; setValues(); validation and calculations
Focused source spotlight
This is an excerpt, not a standalone script. The complete implementation follows.
function showAppointments(){
// Use a fixed seven-day window for the workshop example.
output('Upcoming',['Title','Date','Time'],input('Appointments').filter(r=>day(r[1])>='2026-11-25'&&day(r[1])<'2026-12-02').sort((a,b)=>day(a[1]).localeCompare(day(b[1]))));
}Complete Code.gs
// Personal Appointment and Reminder Manager
// Entry point: showAppointments; source data stays intact unless explicitly noted.
function onOpen(){SpreadsheetApp.getUi().createMenu("Workshop").addItem("Run application","showAppointments").addToUi();}
function showAppointments(){
// Use a fixed seven-day window for the workshop example.
output('Upcoming',['Title','Date','Time'],input('Appointments').filter(r=>day(r[1])>='2026-11-25'&&day(r[1])<'2026-12-02').sort((a,b)=>day(a[1]).localeCompare(day(b[1]))));
}
function input(name) { const s=SpreadsheetApp.getActive().getSheetByName(name); if(!s) throw Error('Missing tab: '+name); return s.getDataRange().getValues().slice(1).filter(r=>r.some(v=>v!=='')); }
function output(name,headers,rows) { const ss=SpreadsheetApp.getActive(); const s=ss.getSheetByName(name)||ss.insertSheet(name); s.clearContents(); s.getRange(1,1,1,headers.length).setValues([headers]).setFontWeight('bold'); if(rows.length) s.getRange(2,1,rows.length,headers.length).setValues(rows.map(r=>r.map(v=>typeof v==='string' && /^[=+@-]/.test(v)?"'"+v:v))); s.setFrozenRows(1); return s; }
function day(v){return v instanceof Date?Utilities.formatDate(v,SpreadsheetApp.getActive().getSpreadsheetTimeZone(),'yyyy-MM-dd'):String(v).slice(0,10);}
Four guided activities
Discover and run
Upcoming appointments can be overlooked.
- Inspect the editable Appointments table. The starter has 2 records.
- Write your predicted result in Prediction. Click Run application.
- Compare Output with: Dentist only
- Click Verify baseline; explain one result in Notes.
Expected: Dentist only
Understand and modify
Change Car service date to 2026-11-29; expect two rows.
- Open Source and read showAppointments. Select the entry function in the walkthrough.
- Return to Application. Click Prepare original challenge to create a separate challenge starting state.
- For AI projects inspect the revised recorded fixture: this is supplied response data, not newly generated AI.
- Run application and use Verify challenge; approval/sidebar projects show extra required steps.
Expected: Change Car service date to 2026-11-29; expect two rows.
Investigate and repair
Exclusive window end
- Save a snapshot if you want to keep your experiment.
- Click Inject investigation. Set Dentist date to 2026-12-02.
- Run application and inspect Output and Execution trace. Some investigations produce wrong/stale content rather than exceptions.
- Repair it: It is excluded. The seven-day window begins 2026-11-25 and ends before 2026-12-02. Run again and explain the root cause.
Expected: The upper bound is exclusive.
Extend and automate
Add optional calendar creation with approval
- Open Prompts. Select Extend and adapt the requirement to your goal.
- Build the feature in Source or export the complete project to Apps Script.
- Retest baseline and original challenge before considering scheduling.
- Use Resources → Automation readiness. Replace fixed date with rolling date and schedule daily refresh.
Expected: The baseline still works; independent extension checks are designed and reviewed by you.
Original exercise
Change Car service date to 2026-11-29; expect two rows.
Debugging and troubleshooting
Exclusive window end
Set Dentist date to 2026-12-02.
Hint 1
Check the exact input/response contract and identify the affected field.
Hint 2
Filter ISO dates between inclusive start and exclusive end; sort by date.
Hint 3 and repair
It is excluded. The seven-day window begins 2026-11-25 and ends before 2026-12-02.
The upper bound is exclusive.
Missing tab: check its exact name. Missing document: ensure unique native companion Docs share the Sheet’s dedicated folder. Authorization failure: review source and contact your administrator. Recorded response exhausted: add a new explicit fixture; no live AI is running. Invalid JSON: repair syntax before validating schema. Valid but unsupported content: compare each claim with source records.
Build prompt
Build a complete container-bound Apps Script app named Personal Appointment and Reminder Manager. Input tab Appointments, headers Title|Date|Time. Implement showAppointments() to list appointments in next seven days from demo date 2026-11-25. Add a menu, preserve inputs, validate data, explain code and test against: Dentist only. For AI use callGemini and treat input as data; never send email. Match the reference entry point showAppointments and its output behavior. Reference: https://github.com/lsvekis/Google-Apps-Script-Workshop/tree/main/25-personal-appointment-and-reminder-manager. Base version limitations: Reference sorts by date only and does not create reminders or events.
Extension prompt
Improve the existing application: Add optional calendar creation with approval. Preserve working features and provide complete code and regression tests. Automation option: Replace fixed date with rolling date and schedule daily refresh. Keep this separate from the baseline exercise.
Knowledge check and answer key
- Which input tab does showAppointments read?
Answer
Appointments
- Which function starts the original application?
Answer
showAppointments
- What is the baseline output you must verify?
Answer
Dentist only
- Does this project need runtime Gemini in the real Workspace baseline?
Answer
No; Gemini can help during development only.
- What limitation matters before scheduling?
Answer
Reference sorts by date only and does not create reminders or events.
Safe automation
Replace fixed date with rolling date and schedule daily refresh.
Reference sorts by date only and does not create reminders or events.
Reflect and extend
Explain the transformation using one actual input row. Which incorrect value could still pass structural validation? What happens if the function runs twice or fails after creating one output? Write your explanation before building this extension: Add optional calendar creation with approval
Source alignment
Physical slide 53; printed sequence 40 of 48. Reference source SHA-256 3bcb6f3a59a44fd037c01790fc1500fce62c5568d54297629907e0aff63aa630.
Pinned repository reference · Full source manifest
Five-minute presenter demonstration
0:00–0:45
Action: Open Input. Read Appointments headers and first row.
Upcoming appointments can be overlooked. This application is useful for Family schedules, personal appointments and service bookings. We will run the verified reference code against fictional data.
0:45–1:30
Action: Ask for predictions. Click Run application, then Verify baseline.
Our baseline is Dentist only The browser displays local results. It has not connected to Google or a model.
1:30–3:00
Action: Open Source. Select showAppointments in the code walkthrough.
Filter ISO dates between inclusive start and exclusive end; sort by date. The complete code is available to edit and download. The excerpt is not a standalone script.
3:00–4:15
Action: Click Prepare original challenge, inspect the changed inputs, and Run application. Complete extra review/sidebar steps if listed.
Change Car service date to 2026-11-29; expect two rows. For AI lessons we edit a recorded response as well as source data. That response must be checked, not trusted.
4:15–5:00
Action: Click Verify challenge. Open Guide and read Automation considerations.
The important limitation is: Reference sorts by date only and does not create reminders or events. Before scheduling: Replace fixed date with rolling date and schedule daily refresh. Explain the result yourself before moving on.