Skip to main content

⚠️ This project is no longer maintained. For automated backup of Google calendars, I would recommend vdirsyncer. For one-time backups, Google Takeout works fine.

Overview

Gcalvault is a command-line utility which exports all of a user's Google Calendars to iCal/ICS format for backup (or portability).

Features:

  • Automatically discovers all calendars visible the user
  • Downloads them in iCal/ICS format and saves them to disk for archival
  • Optionally manages version history for each calendar in an on-disk "vault" (a git repo under the covers)
  • Can be run via Docker image (multi-arch) or installed directly as a Python package with command-line interface

How it works

Usage

Some example commands...

Sync all calendars for foo.bar@gmail.com user:

gcalvault sync foo.bar@gmail.com

Sync one specific calendar:

gcalvault sync foo.bar@gmail.com family123@group.calendar.google.com

Sync only "writable" calendars:

gcalvault sync foo.bar@gmail.com --ignore-role reader

Simply export calendars, do not save version history:

gcalvault sync foo.bar@gmail.com --export-only

See the CLI help for full usage and other notes.

Requirements

  • Python 3.9+

Installation

Via PyPi

pip install gcalvault
gcalvault sync foo.bar@gmail.com

Via Docker

docker run -it --rm \
    -v ${HOME}/.gcalvault:/root/.gcalvault \
    -v ${PWD}/gcalvault:/root/gcalvault \
    rtomac/gcalvault sync foo.bar@gmail.com

OAuth2 authentication

The CLI initiates an OAuth2 authentication the first time it is run (interactive), and then uses refresh tokens for subsequent runs (headless).

When you use Gcalvault in its default configuration, you are initiating the OAuth2 flow with Google using Gcalvault's client ID. There is nothing inherently insecure about this, since the application is running locally and therefore only you will have access to the data it reads from Google.

That said, it is recommended to create your own client ID through the Google API Console, since the shared client ID may be used by others and subject to limits which may cause unpredictable failures.

rclone has a good write-up on making your own client ID.

You can provide your client ID and secret to gcalvault as follows:

gcalvault sync foo.bar@gmail.com --client-id my_client_id --client-secret my_client_secret

If you are providing your own Google OAuth2 client, you will need to ensure the following APIs and OAuth2 scopes are enabled for the project/client in GCP.

Google APIs:

  • Google Calendar API: calendar-json.googleapis.com
  • CalDAV API: caldav.googleapis.com

OAuth2 scopes:

  • openid
  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/calendar.readonly

Development

Source repository:
http://github.com/rtomac/gcalvault

Install dependencies and run locally

pip install virtualenv
make devenv
. ./.devenv/bin/activate
gcalvault --help

Run tests

pytest

Build distribution

make dist

Build Docker image

make docker-build

Run via Docker image

make docker-run user=foo.bar@gmail.com

Release to PyPi and Docker Hub

make release

See targets and variables in Makefile for more options.

License

MIT License

Release files for gcalvault 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gcalvault 2.0.3
File Size Uploaded
gcalvault-2.0.3.tar.gz 13.2 kB Details

Release files / gcalvault-2.0.3.tar.gz

Download URL gcalvault-2.0.3.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f81946bb4b2d263b5038cc81ef80b72b22d5b67af990917b89a39a1db5f9f8fb
BLAKE2b-256 checksum
How to use checksums
458cd506b1a4fe173b29dfe3be5c7c0be82b96e665649e3d9e70bd2b6ddbc1b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

2.0.3 This release

1 release file

2.0.2

1 release file

2.0.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page