I need to convert a large set of ics icalendar events into a LaTeX pgfgantt chart. For this I wrote a tiny script with the help of an answer found here.
from icalendar import Calendar, Event
from datetime import datetime
from pytz import UTC # timezone
g = open('calendar.ics','rb')
gcal = Calendar.from_ical(g.read())
for component in gcal.walk():
if component.name == "VEVENT":
start = component.get('dtstart')
end = component.get('dtend')
print("\ganttbar{"+ str(component.get('summary')) + "}{" + str(start.dt) + "}{" + str(end.dt) + "}\\\\")
g.close()
The path has to be absolute for some reason.