You can create events using the Calendar Class in Google Apps Script. However, only for regular (not all day events) you can set both the start and the end time. For all day events, you can only set one date, so they will always be one day only. Then how can you create all day events?
There are a few workarounds:
- Create a regular event and set the start and end time to midnight; remember to specify midnight of the day after the end day. The drawback is the event fills the whole space for a day in your calendar overview, rather then just a line at the top as with all day events.
- Create a all day event series, so you have a sequence of one-day all day events; this looks already a bit nicer, but in the calendar view, from a single event yio can not see how long it last.
- Create an event from a description, this creates real multi-day all day events.
So creating an event from a description seems the best way to go. This is worked out in a new function,
createMultiDayEvent( calendar, title, startDate, endDate ). Continue reading