DiscoveryVIP · Hands-On AI
PROJECT 13

Automated Task Management System

Overdue tasks get lost in a long list.

Try interactive applicationDownload complete source

What this teaches

Prioritize tasks by deadline. Team deadlines, assignments and personal chores.

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: Tasks. Entry function: updateTasks().

TaskOwnerDueStatus
SlidesAlex2026-11-20Open
BudgetJamie2026-12-05Open
ReviewSam2026-11-19Done

Expected baseline: Slides Overdue; Budget Open; Review Done.

Exact Workspace setup

  1. Download and unzip this project. Use one separate bound script per lesson.
  2. Create a dedicated Drive folder. Create a native Google Sheet inside it, and import starter.csv into a tab named Tasks. Check the exact headers above.
  3. Open the Sheet → Extensions → Apps Script. Paste finished Code.gs into the script editor. Save.
  4. Choose updateTasks in the function selector → Run. Review actual requested permissions. Reload the Sheet for the Workshop menu.
  5. Compare output with the baseline above. Check generated documents/drafts manually. No email should be sent.
  6. 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

markTasks preserves source rows and derives priority using status and ISO date comparison.

Key operations: Utilities.formatDate(); date comparison; setValues(); triggers

Focused source spotlight

This is an excerpt, not a standalone script. The complete implementation follows.

function updateTasks(){
// Fixed date makes workshop tests reproducible.
markTasks('2026-11-25');
}

Complete Code.gs

// Automated Task Management System
// Entry point: updateTasks; source data stays intact unless explicitly noted.
function onOpen(){SpreadsheetApp.getUi().createMenu("Workshop").addItem("Run application","updateTasks").addItem("Install daily trigger","installDaily").addToUi();}
function updateTasks(){
// Fixed date makes workshop tests reproducible.
markTasks('2026-11-25');
}
function input(name) { const s=workshopSpreadsheet().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=workshopSpreadsheet(); 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,workshopSpreadsheet().getSpreadsheetTimeZone(),'yyyy-MM-dd'):String(v).slice(0,10);}
function markTasks(today){output('Priority',['Task','Owner','Due','Status','Priority'],input('Tasks').map(r=>[...r,r[3]==='Done'?'Done':day(r[2])<today?'Overdue':'Open']));}
function updateToday(){markTasks(day(new Date()));}
function installDaily(){PropertiesService.getScriptProperties().setProperty("WORKSHOP_TRIGGER_SHEET",SpreadsheetApp.getActiveSpreadsheet().getId());if(!ScriptApp.getProjectTriggers().some(t=>t.getHandlerFunction()==='updateToday'))ScriptApp.newTrigger('updateToday').timeBased().everyDays(1).create();}

function workshopSpreadsheet(){const active=SpreadsheetApp.getActiveSpreadsheet(); if(active)return active; const id=PropertiesService.getScriptProperties().getProperty("WORKSHOP_TRIGGER_SHEET"); if(!id)throw new Error("Run Install daily trigger from your copied spreadsheet first."); return SpreadsheetApp.openById(id);}

Four guided activities

Discover and run

Overdue tasks get lost in a long list.

  1. Inspect the editable Tasks table. The starter has 3 records.
  2. Write your predicted result in Prediction. Click Run application.
  3. Compare Output with: Slides Overdue; Budget Open; Review Done.
  4. Click Verify baseline; explain one result in Notes.

Expected: Slides Overdue; Budget Open; Review Done.

Understand and modify

Mark Slides Done; its priority becomes Done.

  1. Open Source and read updateTasks. Select the entry function in the walkthrough.
  2. Return to Application. Click Prepare original challenge to create a separate challenge starting state.
  3. For AI projects inspect the revised recorded fixture: this is supplied response data, not newly generated AI.
  4. Run application and use Verify challenge; approval/sidebar projects show extra required steps.

Expected: Mark Slides Done; its priority becomes Done.

Investigate and repair

Fixed reference date

  1. Save a snapshot if you want to keep your experiment.
  2. Click Inject investigation. Change Slides Due to 2026-12-01.
  3. Run application and inspect Output and Execution trace. Some investigations produce wrong/stale content rather than exceptions.
  4. Repair it: It is no longer overdue relative to 2026-11-25. Restore 2026-11-20. Run again and explain the root cause.

Expected: Workshop reproducibility uses a fixed reference date, not today.

Extend and automate

Add a dashboard and configurable reference date.

  1. Open Prompts. Select Extend and adapt the requirement to your goal.
  2. Build the feature in Source or export the complete project to Apps Script.
  3. Retest baseline and original challenge before considering scheduling.
  4. Use Resources → Automation readiness. Install daily trigger from your own copied spreadsheet; the installer stores its ID for background execution.

Expected: The baseline still works; independent extension checks are designed and reviewed by you.

Original exercise

Mark Slides Done; its priority becomes Done.

Debugging and troubleshooting

Fixed reference date

Change Slides Due to 2026-12-01.

Hint 1

Check the exact input/response contract and identify the affected field.

Hint 2

markTasks preserves source rows and derives priority using status and ISO date comparison.

Hint 3 and repair

It is no longer overdue relative to 2026-11-25. Restore 2026-11-20.

Workshop reproducibility uses a fixed reference date, not today.

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

Act as a Google Apps Script tutor. Build a container-bound Sheets app for lesson 13: Automated Task Management System. Input tab Tasks, exact headers: Task, Owner, Due, Status. Create updateTasks() with a fixed demo reference date 2026-11-25; compare date-only values, write Overdue/Open/Done to a Priority column; optional daily trigger uses current date in spreadsheet timezone. Do not depend on Workshop Info or the Workshop Index. Provide complete copy-paste Code.gs (and HTML if required), exact setup/run steps, explain the main code blocks, and include a test matching this expected outcome: Slides Overdue; Budget Open; Review Done. Preserve starter data, use batch operations where appropriate, handle errors, and never send email or delete files. For AI lessons use the supplied callGemini helper, treat input as untrusted, and validate outputs.
Match the reference entry point updateTasks and its output behavior. Reference: https://github.com/lsvekis/Google-Apps-Script-Workshop/tree/main/13-automated-task-management-system. Base version limitations: Workshop run uses fixed date; background access must be tested. For scheduled execution, save the current spreadsheet ID when installing the trigger and use openById when no active spreadsheet exists. Reinstall in each copy.

Extension prompt

Update the existing app without removing working features. Add a dashboard and configurable reference date. Return complete updated files, explain changes and give regression tests.
Automation option: Existing Install daily trigger invokes updateToday using current date. Keep this separate from the baseline exercise.

Knowledge check and answer key

  1. Which input tab does updateTasks read?
    Answer

    Tasks

  2. Which function starts the original application?
    Answer

    updateTasks

  3. What is the baseline output you must verify?
    Answer

    Slides Overdue; Budget Open; Review Done.

  4. Does this project need runtime Gemini in the real Workspace baseline?
    Answer

    No; Gemini can help during development only.

  5. What limitation matters before scheduling?
    Answer

    Workshop run uses fixed date; background access must be tested.

Safe automation

Install daily trigger from your own copied spreadsheet; the installer stores its ID for background execution.

Known limitation

Workshop run uses fixed date; background access must be tested.

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 a dashboard and configurable reference date.

Source alignment

Physical slide 34; printed sequence 25 of 48. Reference source SHA-256 dd87cab2d592812915d99ad1db3885baddbb4e4abc868e4b8ddf7cc1d79cdd7a.

Slide notes use Workshop Info B2. Verified repository resolves the active spreadsheet parent folder; this build follows the repository. Keep companion files in that dedicated lesson folder.

Pinned repository reference · Full source manifest

Five-minute presenter demonstration

0:00–0:45

Action: Open Input. Read Tasks headers and first row.

Overdue tasks get lost in a long list. This application is useful for Team deadlines, assignments and personal chores. 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 Slides Overdue; Budget Open; Review Done. The browser displays local results. It has not connected to Google or a model.

1:30–3:00

Action: Open Source. Select updateTasks in the code walkthrough.

markTasks preserves source rows and derives priority using status and ISO date comparison. 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.

Mark Slides Done; its priority becomes Done. 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: Workshop run uses fixed date; background access must be tested. Before scheduling: Install daily trigger from your own copied spreadsheet; the installer stores its ID for background execution. Explain the result yourself before moving on.

Launch temporary demo