Three submission deadlines in your calendar this month. Your task list should have a "Prepare submission" task for each one. In your current workflow, how do you keep those in sync?
email_sheet_summary from Day 24 chained Sheets and Gmail. For Calendar to Tasks, I'd call GOOGLECALENDAR_FIND_EVENT to get the upcoming events, then loop over them and call GOOGLETASKS_INSERT_TASK for each one.
Exactly. Find the events with a time_min from today, loop over the results, create one task per event. The event's summary field becomes the task title; the event's start time goes into the task notes for context:
for event in events:
title = f"Prepare: {event.get('summary', 'Unnamed event')}"
notes = f"Deadline: {event.get('start', {}).get('dateTime', 'date unknown')}"
toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": title, "notes": notes}
)If I run this script twice, do I get duplicate tasks for every event?
Yes — GOOGLETASKS_INSERT_TASK has no deduplication. If you run the script Monday and Tuesday, Tuesday creates tasks for the same deadlines again. The clean solution: check list_tasks first and skip events whose title already has a matching task. For the Week 4 capstone, we handle this with the safe-send pattern from Day 27 — return a structured result so the caller can see what was created:
def upcoming_to_tasks(cal_id: str, list_id: str) -> list:
from datetime import datetime
time_min = datetime.utcnow().isoformat() + "Z"
events_result = toolset.execute_action(
Action.GOOGLECALENDAR_FIND_EVENT,
{"calendar_id": cal_id, "time_min": time_min}
)
events = events_result.get("items", [])
created = []
for event in events:
title = f"Prepare: {event.get('summary', 'event')}"
notes = f"Deadline: {event.get('start', {}).get('dateTime', '')}"
task = toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": title, "notes": notes}
)
created.append(task)
print(f"Created {len(created)} tasks from {len(events)} events")
return createdSo every deadline in my calendar automatically gets a "Prepare: " task with the submission date in the notes. That's the entire deadline management system I've been trying to build with manual reminders.
Manual reminders are now a legacy system. Your calendar and your task list are in sync.
I could wire my whole Monday morning in this. Literature check, co-author update, deadline tasks — one script, one run.
That is Week 4, Day 28. You're thinking exactly the right way.
# 1. Find upcoming events
events = toolset.execute_action(
Action.GOOGLECALENDAR_FIND_EVENT,
{"calendar_id": cal_id, "time_min": time_min}
).get("items", [])
# 2. Create a task per event
for event in events:
toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": f"Prepare: {event['summary']}", "notes": "..."}
)| Field | Access |
|---|---|
| Title | event.get('summary', 'event') |
| Start time | event.get('start', {}).get('dateTime', '') |
Check list_tasks before inserting to avoid duplicates on re-runs. This workflow is the Calendar-to-Tasks bridge that keeps your task manager in sync with your calendar without manual copying.
Three submission deadlines in your calendar this month. Your task list should have a "Prepare submission" task for each one. In your current workflow, how do you keep those in sync?
email_sheet_summary from Day 24 chained Sheets and Gmail. For Calendar to Tasks, I'd call GOOGLECALENDAR_FIND_EVENT to get the upcoming events, then loop over them and call GOOGLETASKS_INSERT_TASK for each one.
Exactly. Find the events with a time_min from today, loop over the results, create one task per event. The event's summary field becomes the task title; the event's start time goes into the task notes for context:
for event in events:
title = f"Prepare: {event.get('summary', 'Unnamed event')}"
notes = f"Deadline: {event.get('start', {}).get('dateTime', 'date unknown')}"
toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": title, "notes": notes}
)If I run this script twice, do I get duplicate tasks for every event?
Yes — GOOGLETASKS_INSERT_TASK has no deduplication. If you run the script Monday and Tuesday, Tuesday creates tasks for the same deadlines again. The clean solution: check list_tasks first and skip events whose title already has a matching task. For the Week 4 capstone, we handle this with the safe-send pattern from Day 27 — return a structured result so the caller can see what was created:
def upcoming_to_tasks(cal_id: str, list_id: str) -> list:
from datetime import datetime
time_min = datetime.utcnow().isoformat() + "Z"
events_result = toolset.execute_action(
Action.GOOGLECALENDAR_FIND_EVENT,
{"calendar_id": cal_id, "time_min": time_min}
)
events = events_result.get("items", [])
created = []
for event in events:
title = f"Prepare: {event.get('summary', 'event')}"
notes = f"Deadline: {event.get('start', {}).get('dateTime', '')}"
task = toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": title, "notes": notes}
)
created.append(task)
print(f"Created {len(created)} tasks from {len(events)} events")
return createdSo every deadline in my calendar automatically gets a "Prepare: " task with the submission date in the notes. That's the entire deadline management system I've been trying to build with manual reminders.
Manual reminders are now a legacy system. Your calendar and your task list are in sync.
I could wire my whole Monday morning in this. Literature check, co-author update, deadline tasks — one script, one run.
That is Week 4, Day 28. You're thinking exactly the right way.
# 1. Find upcoming events
events = toolset.execute_action(
Action.GOOGLECALENDAR_FIND_EVENT,
{"calendar_id": cal_id, "time_min": time_min}
).get("items", [])
# 2. Create a task per event
for event in events:
toolset.execute_action(
Action.GOOGLETASKS_INSERT_TASK,
{"tasklist_id": list_id, "title": f"Prepare: {event['summary']}", "notes": "..."}
)| Field | Access |
|---|---|
| Title | event.get('summary', 'event') |
| Start time | event.get('start', {}).get('dateTime', '') |
Check list_tasks before inserting to avoid duplicates on re-runs. This workflow is the Calendar-to-Tasks bridge that keeps your task manager in sync with your calendar without manual copying.
Create a free account to get started. Paid plans unlock all tracks.