# ICS to SQLite
This repository contains a script that converts ICS calendar files to SQLite databases. It's useful for analyzing and manipulating calendar data, especially when combined with [Datasette](https://datasette.io).
## Usage
```shell
pip install ics-to-datasette
ics-to-datasette calendar.ics
```
Here's the full help options:
```shell
Usage: ics-to-datasette [OPTIONS] ICS_FILES...
Options:
--output [json|sqlite]
--dbname TEXT Name of the SQLite database file
--help Show this message and exit.
```
## Development
Run the script with the following command:
```shell
poetry run python run.py <ics_file_paths> --output=json
```
### Getting Calendar Data From Google Calendar
You can download your calendar data from Google Calendar by going to [Google Takeout](https://takeout.google.com/settings/takeout) and selecting the "Calendar" option. You can then extract the downloaded zip file and run the script on the extracted ICS files.
Select `tgz` to avoid multiple archives from being created due to file size limits.
### Datasette
You can use the `datasette` command to run a Datasette server with the generated SQLite database:
```shell
pip install datasette
datasette serve <database_path>
```
## Views
* `events_with_guests`. Only events that have at least one guest are included in this view. Guests entries like `%group.calendar.google.com` are excluded.
* `event_emails_with_count`. This view contains a list of all emails along with the number of events that each email appears in. Helpful for determining your most popular contacts.
### Library Options
Some of the python ical parsing library options I explored:
* <https://allenporter.github.io/ical/ical.html#recurring-events>
* <https://github.com/ics-py/ics-py>
## TODO
- [ ] add option for additional exclusions
Raw data
{
"_id": null,
"home_page": "https://github.com/iloveitaly/ics-to-datasette",
"name": "ics-to-datasette",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "ics,calendar,datasette,sqlite,sqlite-database,datasette-tool",
"author": "Michael Bianco",
"author_email": "mike@mikebian.co",
"download_url": "https://files.pythonhosted.org/packages/15/cb/614767701d0efb27bb7638301f9cda788cd1f8e94383eb46832d81135aa7/ics_to_datasette-0.3.0.tar.gz",
"platform": null,
"description": "# ICS to SQLite\n\nThis repository contains a script that converts ICS calendar files to SQLite databases. It's useful for analyzing and manipulating calendar data, especially when combined with [Datasette](https://datasette.io).\n\n## Usage\n\n```shell\npip install ics-to-datasette\n\nics-to-datasette calendar.ics\n```\n\nHere's the full help options:\n\n```shell\nUsage: ics-to-datasette [OPTIONS] ICS_FILES...\n\nOptions:\n --output [json|sqlite]\n --dbname TEXT Name of the SQLite database file\n --help Show this message and exit.\n```\n\n## Development\n\nRun the script with the following command:\n\n```shell\npoetry run python run.py <ics_file_paths> --output=json\n```\n\n### Getting Calendar Data From Google Calendar\n\nYou can download your calendar data from Google Calendar by going to [Google Takeout](https://takeout.google.com/settings/takeout) and selecting the \"Calendar\" option. You can then extract the downloaded zip file and run the script on the extracted ICS files.\n\nSelect `tgz` to avoid multiple archives from being created due to file size limits.\n\n### Datasette\n\nYou can use the `datasette` command to run a Datasette server with the generated SQLite database:\n\n```shell\npip install datasette\ndatasette serve <database_path>\n```\n\n## Views\n\n* `events_with_guests`. Only events that have at least one guest are included in this view. Guests entries like `%group.calendar.google.com` are excluded.\n* `event_emails_with_count`. This view contains a list of all emails along with the number of events that each email appears in. Helpful for determining your most popular contacts.\n\n### Library Options\n\nSome of the python ical parsing library options I explored:\n\n* <https://allenporter.github.io/ical/ical.html#recurring-events>\n* <https://github.com/ics-py/ics-py>\n\n\n## TODO\n\n- [ ] add option for additional exclusions",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert an ICS file to a SQLite database",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/iloveitaly/ics-to-datasette"
},
"split_keywords": [
"ics",
"calendar",
"datasette",
"sqlite",
"sqlite-database",
"datasette-tool"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "79ed0958d1fdb9a2f3c43f83d476030b35ba40fe4285399d4f423d42cf8253df",
"md5": "26a3660f88df1a9027087b2939a0ad58",
"sha256": "42ce2569480bff1baf0812a2fd212298c9bd16d262e8c8128533aea2904c4ae2"
},
"downloads": -1,
"filename": "ics_to_datasette-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26a3660f88df1a9027087b2939a0ad58",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 3562,
"upload_time": "2024-01-13T15:38:23",
"upload_time_iso_8601": "2024-01-13T15:38:23.048757Z",
"url": "https://files.pythonhosted.org/packages/79/ed/0958d1fdb9a2f3c43f83d476030b35ba40fe4285399d4f423d42cf8253df/ics_to_datasette-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "15cb614767701d0efb27bb7638301f9cda788cd1f8e94383eb46832d81135aa7",
"md5": "3b68118e02d2aea384456d1fa4027f74",
"sha256": "6a96bcf0f22356f11897471df69582c3e313bbd12fe19e95297908a8adaa6691"
},
"downloads": -1,
"filename": "ics_to_datasette-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "3b68118e02d2aea384456d1fa4027f74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 2921,
"upload_time": "2024-01-13T15:38:24",
"upload_time_iso_8601": "2024-01-13T15:38:24.697285Z",
"url": "https://files.pythonhosted.org/packages/15/cb/614767701d0efb27bb7638301f9cda788cd1f8e94383eb46832d81135aa7/ics_to_datasette-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-13 15:38:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "iloveitaly",
"github_project": "ics-to-datasette",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ics-to-datasette"
}