Add reminder to Google Calendar using Google App Script

768 views
Skip to first unread message

Ricky

unread,
Nov 29, 2021, 2:49:37 AM11/29/21
to Google Apps Script Community
I have a Google App Script that creates calendar events in my Google Calendar. The problem is that the events are created automatically with the notification set to 12am, the day before. This seems to be the default and I don't know how to change that.


What I want is to set it like this (using Google App Script):


I understand there's this method that I can use - addEmailReminder(minutesBefore). The problem is that the "minutesBefore" is relative to the calendar event itself. If I set minutesBefore to 30 minutes and the calendar event was created at 11:00pm, then the notification will be 10:30pm. If the calendar event was created at 2:00pm, then the notification will be 1:30pm. This is not consistent.

I need to hardcode the notification to always be at a specific time. I need notification for both Email and Notification (as per screenshot). How can I do this?

Clark Lind

unread,
Nov 29, 2021, 9:21:26 AM11/29/21
to Google Apps Script Community
Can you share your script? You should be able to use "getStartTime()", do a little math, and set the "minutesBefore" accordingly.  So basically, 
-get event start time
-convert to minutes   (example:  10:30AM.  =   [hours to minutes] 10 * 60 = 600 then add 30. 
       So 10:30am = 630 minutes after midnight

You could then add the popup notification as   addPopupReminder(700)    [11:30pm = 30 minutes before midnight]  

and the second notification as    addEmailReminder(1410)    [11am day before = 13 hours before midnight  = 780 minutes]
Reply all
Reply to author
Forward
0 new messages