One method of quickly creating a lot of events in google calendar is to import a CSV file. However, there is no support for directly adding "recurring" events (birthdays, anniversaries, etc). Here's the workarond.
- create csv file with events (no recurring)
- import csv into a new, temporary google calendar
- export temporary google calendar to an ics file
- edit ics file to change events into recurring
- import ics file into a new, permanent google calendar.
- delete temporary google calendar
The CSV format can be found at https://support.google.com/calendar/answer/37118?hl=en
4a. manually by adding RRULE:FREQ=YEARLY
between each set of VEVENT
begin/close statements. For example:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20180520
DTEND;VALUE=DATE:20180521
RRULE:FREQ=YEARLY
...
END:VEVENT
or
4b. automatically by running this python
import icalendar
import os
def make_recurring():
directory = os.path.dirname(__file__)
with open(os.path.join(directory, 'noRecur.ics'), 'r') as fr:
data = fr.read()
cal = icalendar.Calendar.from_ical(data)
for event in cal.subcomponents:
if 'RRULE' not in event.keys():
event.add('rrule', {'freq': ['YEARLY']})
with open(os.path.join(directory, 'withRecur.ics'), 'wb') as fw:
fw.write(cal.to_ical())
Hello, sorry for dumb question but where is the output after running the python code?
I don't exactly know what I was supposed to do, I tried to put both .py and .ics file that I wanted to add RRULE YEARLY but after running the .py file nothing happens.
Was I supposed to specify wheres the input file located and the output file destination? It wasn't very clear in Step 4. I understand adding RRULE YEARLY manually but I need to edit 400 events :(