https://github.com/skn0tt/icbu-to-sqlite
Analyze your Apple Calendar with SQL!
https://github.com/skn0tt/icbu-to-sqlite
calendar productivity sql
Last synced: 5 months ago
JSON representation
Analyze your Apple Calendar with SQL!
- Host: GitHub
- URL: https://github.com/skn0tt/icbu-to-sqlite
- Owner: Skn0tt
- License: mit
- Created: 2021-04-20T15:42:22.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:22:30.000Z (over 2 years ago)
- Last Synced: 2024-10-06T04:01:32.893Z (over 1 year ago)
- Topics: calendar, productivity, sql
- Language: JavaScript
- Homepage:
- Size: 1.95 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# icbu-to-sqlite
> Run full SQL queries on your calendar!
This repo contains a small script to pipe your Apple Calendar data into an SQLite database.
## Usage
1. Clone this repository.
```bash
git clone https://github.com/skn0tt/icbu-to-sqlite /some-dir
```
2. Export your calendar archive into `/some-dir/cal.icbu`.


3. Run `npm i` && `node index.js`.
4. Run your queries on `db.sqlite`!

Full Query
```sql
SELECT
SUM((strftime('%s', dtend) - strftime('%s', dtstart)) / 3600) as duration,
calendar.title as calendar
FROM event
JOIN calendar ON calendar.id = calendarId
WHERE event.transp <> 'TRANSPARENT'
AND dtstart BETWEEN {{start}} AND {{end}}
GROUP BY calendarId
```