Skip to main content

Sync iCalendar events to org-mode files while preserving your notes

Project description

ics-to-org

Tests PyPI version

Sync iCalendar events to org-mode files while preserving your notes.

What's New in v1.0.0

This is a major rewrite with significantly improved reliability and simplicity:

  • No more Node.js dependency - Pure Python implementation using the icalendar library
  • Cleaner org format - ICS descriptions stored in :DESCRIPTION: property, user notes go directly in the event body
  • Bulletproof merge logic - Calendar data always updates, user notes always preserved
  • Better timezone handling - Proper handling of UTC and all-day events
  • Comprehensive tests - Real .ics files and .org examples with full integration testing

Installation

Simple single-step installation:

pip install ics-to-org

Or with uv:

uv tool add ics-to-org

Usage

After installation, you can run the tool:

ics-sync --ics-url "https://outlook.office365.com/..." \
         --org-file "meetings.org" \
         --days-forward 30 \
         --days-backward 7

Or run it directly with uvx (no installation needed):

uvx --from ics-to-org ics-sync --ics-url "https://calendar.google.com/calendar/ical/..." \
                                  --org-file "calendar.org"

Command-line options:

Option Description Default
–ics-url URL of the iCalendar feed (required) -
–org-file Path to the org file to update (required) -
–days-forward Number of days forward to fetch 30
–days-backward Number of days backward to fetch 7
–debug Enable debug logging false

How It Works

The sync process:

  1. Fetches your calendar from the ICS URL
  2. Parses your existing org file to extract user notes
  3. Merges calendar updates with your preserved notes:
    • Calendar data (title, time, location, description) always gets updated
    • Your personal notes are always preserved
    • Removed events are marked as CANCELLED: but kept with your notes
    • New events are added cleanly
  4. Writes the updated org file with events sorted by date

Org File Format

Events are stored in a clean, standard org format:

* Team Meeting
:PROPERTIES:
:UID:           meeting123@company.com
:LOCATION:      Conference Room A
:DESCRIPTION:   Weekly team sync and project updates
:STATUS:        CONFIRMED
:CATEGORIES:    Work
:END:
<2025-01-15 Wed 14:00-15:00>

My personal notes for the meeting:
- Remember to bring the quarterly report
- Ask about the new project timeline
- Discuss vacation schedule

Action items:
- [ ] Finish the client proposal
- [X] Review the budget numbers

Key features of the format:

  • :DESCRIPTION: contains the calendar description (read-only)
  • :UID: provides the unique identifier for syncing
  • Event body contains your personal notes in any format (markdown, org-mode, plain text)
  • All-day events show as <2025-01-20 Mon>
  • Timed events show as <2025-01-15 Wed 14:00-15:00>

Examples

Basic sync with default settings

ics-sync --ics-url "https://calendar.google.com/calendar/ical/..." \
         --org-file "calendar.org"

Longer time range with debug output

ics-sync --ics-url "https://outlook.office365.com/owa/calendar/..." \
         --org-file "work-calendar.org" \
         --days-forward 60 \
         --days-backward 14 \
         --debug

Using with uvx (no installation required)

# Run directly from PyPI without installing
uvx --from ics-to-org ics-sync --ics-url "https://example.com/calendar.ics" \
                                  --org-file "my-calendar.org" \
                                  --days-forward 60 \
                                  --debug

Using with uv run (in a project)

uv run ics-sync --ics-url "https://example.com/calendar.ics" \
                --org-file "my-calendar.org"

Using with local .ics files

If you can't access the calendar URL directly (common with Outlook), download the .ics file and use it locally:

# Using a local file path
ics-sync --ics-url "/path/to/downloaded/calendar.ics" \
         --org-file "calendar.org"

# Or with file:// URL
ics-sync --ics-url "file:///path/to/calendar.ics" \
         --org-file "calendar.org"

Troubleshooting

Outlook/Office365 Calendar Issues

If you're having trouble accessing your Outlook calendar:

  1. Download the .ics file manually: Go to Outlook Web → Calendar → Share → Publish Calendar → Copy the ICS URL → Download it with your browser
  2. Use the downloaded file: ics-sync --ics-url "/path/to/calendar.ics" --org-file "events.org"
  3. Check calendar permissions: Make sure your calendar is set to "Public" with "Can view all details" in Outlook settings
  4. Try the debug flag: Run with --debug to see detailed error messages

Common Error Messages

  • *"Received HTML response instead of ICS data"*: The calendar URL requires authentication or is private
  • *"Authentication required"*: Calendar is not publicly accessible
  • *"Object moved to here"*: Calendar URL has redirects/authentication issues

For these issues, downloading the .ics file manually is the most reliable solution.

Testing

The project includes comprehensive tests with realistic examples:

pytest tests/ -v

Test coverage includes:

  • Unit tests for all core functions
  • Integration tests with real .ics files and .org files
  • Edge cases like timezone handling, malformed events, empty calendars
  • User note preservation across various markdown and org-mode formats
  • Complete workflows from ICS fetch through merge to org file output

Migration from v0.x

If you're upgrading from the old version:

  1. Remove the icsorg dependency: npm uninstall -g icsorg
  2. Update your scripts: Remove --author and --email parameters (no longer needed)
  3. Review your org files: The new format stores descriptions in properties instead of agenda blocks

The new format is cleaner and more reliable, but you may want to manually clean up old agenda blocks if desired.

Development

# Clone the repository
git clone https://github.com/andyreagan/ics-to-org
cd ics-to-org

# Install with uv (recommended)
uv sync

# Run tests
uv run pytest

# Build package
uv build

Contributing

Contributions are welcome! Please:

  1. Add tests for any new functionality
  2. Ensure all tests pass: uv run pytest
  3. Follow the existing code style
  4. Update documentation as needed

License

MIT License. See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ics_to_org-1.0.3.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ics_to_org-1.0.3-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file ics_to_org-1.0.3.tar.gz.

File metadata

  • Download URL: ics_to_org-1.0.3.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ics_to_org-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d38ff6a654b4c8d27121a0e40e7c5163cfc56b78c3467280a2e69285749bf819
MD5 646e0fad27c1ab08e01f721895899db7
BLAKE2b-256 8e33f489944b3086960d7f508516ff39c842decc83c5ca28af77fc632223805e

See more details on using hashes here.

File details

Details for the file ics_to_org-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ics_to_org-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ics_to_org-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c23e6d360f9014ee1440720374d1323e86690e949fbd287a55b0bd391e2a03
MD5 b4b8a9984cac1fb1cc90ac6905895f26
BLAKE2b-256 bf7730277802020e3140d1453380c25cda937ca0c5009f256d3212955d7686e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page