Skip to content

pschmitt/gcal-import-ics

Repository files navigation

📅 Import ICS files to your Google Calendar, without the web interface.

Build

TL;DR

docker run -it --rm \
  -e "TZ=Europe/Berlin" \
  -v "$PWD/config:/config" \
  pschmitt/gcal-import-ics:latest \
    "My Personal Calendar" \
    /data/calendar.ics

and the main star of the show is 🌟 gcal_import.py

Installation

git clone https://github.com/pschmitt/gcal-import-ics
cd gcal-import-ics

python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Setup

You will need the following:

  • Your calendar ID (or its name)
  • a JSON credentials file. See here for instructions.

Usage

python3 gcal_import.py \
  --debug \
  -c ./credentials/client_secret_blablablabla.apps.googleusercontent.com.json \
  -t ./credentials/gcal.token \
  -p "PROXY=socks5h://corp.acme.com:8080" \
  "$GOOGLE_CALENDAR_NAME_OR_ID" \
  "$ICS_FILE_PATH_OR_URL"

Confluence calendar sync

python3 gcal_import.py \
  --debug \
  -c ./credentials/client_secret_blablablabla.apps.googleusercontent.com.json \
  -t ./credentials/gcal.token \
  -p "PROXY=socks5h://corp.acme.com:8080" \
  --confluence-url https://confluence.acme.com \
  --confluence-username admin \
  --confluence-password somePAssword01 \
  --confluence-calendars "Team Calendar" \
  --confluence-calendars "Company events" \
  --confluence-calendar-prefix "Work: "

But why?

  1. https://groups.google.com/g/google-apps-manager/c/tgIAB35I5EE?pli=1
  2. Google Calendar seems to be unable to fetch ics files behind basic auth

TODO

  • 🚧 Fix status for some imported events (they are created with status=cancelled)
  • Requests proxy option
  • Delete unknown events
  • With an optional date parameter (ie only delete future events)
  • All-day events
  • Attendees
  • Reminders
  • Store metadata ("imported by gcal_import.py") somewhere (in source? organizer? description?)
  • Clear calendar before import (optional)
  • Wait and retry when rate-limitted
  • Optionally ignore SEQUENCE and always update
  • Allow passing in the calendar name, instead of the ID
  • Support recurring event instances
  • Allow settings args with environment variables
  • Confluence calendar sync