{"id":15432951,"url":"https://github.com/simonw/google-calendar-to-sqlite","last_synced_at":"2025-04-19T17:51:50.741Z","repository":{"id":57690681,"uuid":"494839851","full_name":"simonw/google-calendar-to-sqlite","owner":"simonw","description":"Create a SQLite database containing your data from Google Calendar","archived":false,"fork":false,"pushed_at":"2022-05-21T16:58:35.000Z","size":15,"stargazers_count":57,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-18T07:53:33.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-21T16:41:58.000Z","updated_at":"2024-10-10T02:24:45.000Z","dependencies_parsed_at":"2022-09-26T20:52:42.426Z","dependency_job_id":null,"html_url":"https://github.com/simonw/google-calendar-to-sqlite","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fgoogle-calendar-to-sqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fgoogle-calendar-to-sqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fgoogle-calendar-to-sqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fgoogle-calendar-to-sqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/google-calendar-to-sqlite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249753088,"owners_count":21320664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T18:29:37.108Z","updated_at":"2025-04-19T17:51:50.724Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-calendar-to-sqlite\n\n[![PyPI](https://img.shields.io/pypi/v/google-calendar-to-sqlite.svg)](https://pypi.org/project/google-calendar-to-sqlite/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/google-calendar-to-sqlite?include_prereleases\u0026label=changelog)](https://github.com/simonw/google-calendar-to-sqlite/releases)\n[![Tests](https://github.com/simonw/google-calendar-to-sqlite/workflows/Test/badge.svg)](https://github.com/simonw/google-calendar-to-sqlite/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/google-calendar-to-sqlite/blob/master/LICENSE)\n\nCreate a SQLite database containing your data from [Google Calendar](https://www.google.com/calendar)\n\nThis lets you use SQL to analyze your Google Calendar data, using [Datasette](https://datasette.io/) or the SQLite command-line tool or any other SQLite database browsing software.\n\n## Installation\n\nInstall this tool using `pip`:\n\n    pip install google-calendar-to-sqlite\n\n## Quickstart\n\nAuthenticate with Google Calendar by running:\n\n    google-calendar-to-sqlite auth\n\nNow create a SQLite database containing your calendar data with:\n\n    google-calendar-to-sqlite events calendar.db your-email@gmail.com\n\nYou can pass one or more calendar IDs - these look like email addresses. Your primary Gmail account corresponds to your personal calendar.\n\nIf you pass no calendar IDs this will fetch events from all of your calendars:\n\n    google-calendar-to-sqlite events calendar.db\n\nThis command will create an `events` table with a row for each event. Repeating events will appoar only once, with their recurrence rules stored in the `recurrence` column.\n\nYou can explore the resulting database using [Datasette](https://datasette.io/):\n\n    $ pip install datasette\n    $ datasette calendar.db\n    INFO:     Started server process [24661]\n    INFO:     Uvicorn running on http://127.0.0.1:8001\n\n## See a list of calendars\n\nYou can see a list of your calendars using:\n\n    google-calendar-to-sqlite calendars\n\nThis will output their ID and name to the terminal:\n\n    $ google-calendar-to-sqlite calendars             \n    Work: 2mcbt9bcthbvsm21j4rp4drhs8@group.calendar.google.com\n    Simon Stanford Classes: tsblj5a6il733cd92kv08crkrg@group.calendar.google.com\n    Pillar Point Stewards: tqhbk05br2h57kcd0gebbt9nmoq3iebt@import.calendar.google.com\n    Holidays in United States: en.usa#holiday@group.v.calendar.google.com\n\nIf you add a database filename that list will be used to populate a detailed `calendars` table:\n\n    google-calendar-to-sqlite calendars calendar.db\n\nEvents in that same database will have foreign keys back to the calendar they belong to.\n\n## Authentication\n\n\u003e :warning: **This application has not yet been verified by Google** - you may find you are unable to authenticate until that verification is complete.\n\u003e\n\u003e You can work around this issue by [creating your own OAuth client ID key](https://til.simonwillison.net/googlecloud/google-oauth-cli-application) and passing it to the `auth` command using `--google-client-id` and `--google-client-secret`.\n\nFirst, authenticate with Google Calendar using the `auth` command:\n\n    $ google-calendar-to-sqlite auth\n    Visit the following URL to authenticate with Google Calendar\n\n    https://accounts.google.com/o/oauth2/v2/auth?...\n\n    Then return here and paste in the resulting code:\n    Paste code here: \n\nFollow the link, sign in with Google Calendar and then copy and paste the resulting code back into the tool.\n\nThis will save an authentication token to the file called `auth.json` in the current directory.\n\nTo specify a different location for that file, use the `--auth` option:\n\n    google-calendar-to-sqlite auth --auth ~/google-calendar-auth.json\n\nFull `--help`:\n\n\u003c!-- [[[cog\nimport cog\nfrom google_calendar_to_sqlite import cli\nfrom click.testing import CliRunner\nrunner = CliRunner()\nresult = runner.invoke(cli.cli, [\"auth\", \"--help\"])\nhelp = result.output.replace(\"Usage: cli\", \"Usage: google-calendar-to-sqlite\")\ncog.out(\n    \"```\\n{}\\n```\\n\".format(help)\n)\n]]] --\u003e\n```\nUsage: google-calendar-to-sqlite auth [OPTIONS]\n\n  Authenticate user and save credentials\n\nOptions:\n  -a, --auth FILE              Path to save token, defaults to auth.json\n  --google-client-id TEXT      Custom Google client ID\n  --google-client-secret TEXT  Custom Google client secret\n  --scope TEXT                 Custom token scope\n  --help                       Show this message and exit.\n\n```\n\u003c!-- [[[end]]] --\u003e\n\nTo revoke the token that is stored in `auth.json`, such that it cannot be used to access Google Calendar in the future, run the `revoke` command:\n\n    google-calendar-to-sqlite revoke\n\nOr if your token is stored in another location:\n\n    google-calendar-to-sqlite revoke -a ~/google-calendar-auth.json\n\nYou will need to obtain a fresh token using the `auth` command in order to continue using this tool.\n\n\n## Database schema\n\nThe database created by this tool has the following schema:\n\n```sql\nCREATE TABLE [calendars] (\n   [id] TEXT PRIMARY KEY,\n   [name] TEXT,\n   [description] TEXT,\n   [kind] TEXT,\n   [etag] TEXT,\n   [summary] TEXT,\n   [timeZone] TEXT,\n   [colorId] TEXT,\n   [backgroundColor] TEXT,\n   [foregroundColor] TEXT,\n   [accessRole] TEXT,\n   [defaultReminders] TEXT,\n   [conferenceProperties] TEXT,\n   [location] TEXT,\n   [selected] INTEGER,\n   [summaryOverride] TEXT,\n   [notificationSettings] TEXT,\n   [primary] INTEGER\n);\nCREATE TABLE [events] (\n   [id] TEXT PRIMARY KEY,\n   [summary] TEXT,\n   [location] TEXT,\n   [start_dateTime] TEXT,\n   [end_dateTime] TEXT,\n   [description] TEXT,\n   [calendar_id] TEXT REFERENCES [calendars]([id]),\n   [kind] TEXT,\n   [etag] TEXT,\n   [status] TEXT,\n   [htmlLink] TEXT,\n   [created] TEXT,\n   [updated] TEXT,\n   [creator] TEXT,\n   [organizer] TEXT,\n   [iCalUID] TEXT,\n   [sequence] INTEGER,\n   [reminders] TEXT,\n   [eventType] TEXT,\n   [attendees] TEXT,\n   [recurringEventId] TEXT,\n   [originalStartTime] TEXT,\n   [start_date] TEXT,\n   [end_date] TEXT,\n   [transparency] TEXT,\n   [start_timeZone] TEXT,\n   [end_timeZone] TEXT,\n   [recurrence] TEXT,\n   [guestsCanInviteOthers] INTEGER,\n   [extendedProperties] TEXT,\n   [colorId] TEXT,\n   [hangoutLink] TEXT,\n   [conferenceData] TEXT,\n   [visibility] TEXT,\n   [privateCopy] INTEGER,\n   [guestsCanSeeOtherGuests] INTEGER,\n   [attachments] TEXT\n);\n```\n\n## Privacy policy\n\nThis tool requests access to your Google Calendar account in order to retrieve events from your calendar and store them in a local SQLite database file on your machine.\n\nThe credentials used to access your account are stored in the `auth.json` file on your computer. The data retrieved from Google Calendar is also stored only on your own personal computer.\n\nAt no point do the developers of this tool gain access to any of your data.\n\n## Development\n\nTo contribute to this tool, first checkout the code. Then create a new virtual environment:\n\n    cd google-calendar-to-sqlite\n    python -m venv venv\n    source venv/bin/activate\n\nOr if you are using `pipenv`:\n\n    pipenv shell\n\nNow install the dependencies and test dependencies:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fgoogle-calendar-to-sqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fgoogle-calendar-to-sqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fgoogle-calendar-to-sqlite/lists"}