1.5 KiB
1.5 KiB
Generate ICS from CSV
This script generates an ICS file containing events converted from a CSV file.
You'll need to install two python modules:
pip install -r requirements.txt
calling the script will prompt for the CSV file.
The output will be two files. One is the CSV file with the .ics
extension, the other is a event_uids.json
containing the unique identifier of each event line.
This will make updating the events via the CSV file easier.
Key Features:
- UID Persistence: Event UIDs are stored in a JSON file (event_uids.json). If the event key (based on description, date, start time, and location) exists, the same UID is reused.
- LAST-MODIFIED Field: The last_modified timestamp is added to each event, ensuring updates are detected by calendar applications.
- Resilience to Changes: If an event's details are modified in the CSV, the application recognizes it as an update due to the persistent UID.
Benefits:
Consistent Updates: Calendar applications update events with matching UIDs rather than creating duplicates. Persistence: Even if the script is rerun, previously assigned UIDs remain consistent.
example CSV file format
Gastgeber;Description;Date;start time;end time;Location
Max Müller;Team Meeting;20.11.2024;10:00;11:00;Berlin
Anna Löwe;Project Kickoff;21.11.2024;09:00;10:30;München
Example ICS output
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20241120T100000
DTEND;TZID=Europe/Berlin:20241120T110000
SUMMARY:Team Meeting (Host: Max Müller)
LOCATION:Berlin
END:VEVENT