Never forget to leave on time again.

A free Google Apps Script that reads your Google Calendar and adds a travel block before every event: when to leave, and whether to walk, bike, take public transport (including NS trains) or drive.

TuesdayTravel calendar + your calendar
08:00
09:00
10:00
11:00
12:00
13:00
๐Ÿš† Leave 08:25 ยท NS
LectureMain Building, Delft
๐Ÿšถ Leave 10:30 ยท Walking
Project meetingLibrary, Delft
๐Ÿšฒ Leave 12:20 ยท Biking home

What it does

Put a location on your events and the script handles the rest. It runs automatically whenever your calendar changes.

โฐ

Tells you when to leave

Every travel block is titled like ๐Ÿšฒ Leave 08:42 ยท Biking, so a glance at your calendar or a notification is enough.

๐Ÿงญ

Picks the best way

Compares walking, biking, public transport, NS and driving. Short trips are walked, medium ones biked, and otherwise the fastest option wins.

๐Ÿš†

NS journey planner

In the Netherlands, it plans trains with the official NS API: tracks, transfers, fares and crowd forecasts, with the way to and from the station planned too.

๐Ÿ”—

One tap to directions

Every travel option is a link that opens that exact mode in Google Maps with arrive by set to your event, so traffic and timetables are right.

๐Ÿ“

Knows where you are

Back-to-back events? It routes from your previous event. Long gap? It assumes you went home. After the last event it plans your trip home. Sleeping somewhere else? Add a multi-day all-day event with that address.

๐Ÿšฒ

Knows where your bike is

From home you bike to the bus stop or station instead of walking. Your bike stays where you parked it, and at the end of the day you're sent back to it to ride home.

โ—

Warns when it doesn't fit

Not enough time between two events? You get one block marked โ— that leaves when the first one ends, with how late you'll be and when you'd have to leave to be on time.

โœ๏ธ

Respects your own plans

Planned the trip yourself, like a lift or a train you booked? Add it to your travel calendar and no second travel block is added.

โœˆ๏ธ

Custom rules

Keyword rules like "arrive 2 hours early for anything titled flight, and don't plan a return trip".

Everything in the event

Open a travel block to see all options side by side. Each one is a link to that specific travel mode, and the chosen route comes with step-by-step directions.

1. Collect events from every enabled calendar for the next 14 days
2. Work out where you're coming from (home or the previous event)
3. Skip events whose trip hasn't changed since the last run
4. Ask Google Maps and NS for every travel mode, arriving on time
5. Pick the best mode and write a travel block to your travel calendar
6. Clean up blocks for moved or deleted events
๐Ÿš† Leave 08:25 ยท NS
Tuesday ยท 08:25 โ€“ 08:55
๐Ÿ“ Open NS Journey Planner

Route: Home โž” Main Building, Delft
Duration: 28 mins, 0 transfer(s)

๐Ÿ“Š Travel Options Comparison:
  • ๐Ÿšถ Walking: 1 hour 20 mins
  • ๐Ÿšฒ Biking: 42 mins
  • ๐ŸšŒ Transit: 31 mins, leave 08:22
  • ๐Ÿš† NS: 28 mins, leave 08:25 (โ‚ฌ3.40) chosen
  • ๐Ÿš— Driving: 24 mins

Set it up

No servers, no subscriptions. It runs in your own Google account.

  1. Create a travel calendar

    In Google Calendar, add a new calendar called "Travel" and copy its Calendar ID (Settings โ†’ Integrate calendar).

  2. Copy the script

    Create a project on script.google.com and paste in TravelBlocks.gs: all the code in one file.

  3. Add your details

    Add a file Config.local with your TARGET_CALENDAR_ID, HOME_LOCATION and optionally NS_API_KEY (free at apiportal.ns.nl), or set them as Script Properties.

  4. Run it

    Run syncTravel once and grant permissions. It sets up its own triggers and runs automatically from then on.

Make it yours

All options are documented in the CONFIG block of the script. Override the ones you want in your own Config.local file.

// When to walk or bike
MODE_SELECTION: {
  walkIfUnderMinutes: 15,
  bikeIfUnderMinutes: 40,
  allowDriving: false
},

// Arrive 5 minutes early by default
ARRIVAL_BUFFER_MINUTES: 5,

// Special rules by keyword
SPECIAL_RULES: [
  {
    keywords: ['flight', 'vlucht'],
    arrivalBufferMinutes: 120,
    disableReturnHome: true
  }
]