Retrieving Event ID from Event URL of Google Calendar using Google Apps Script

Gists

This is a sample script for retrieving the event ID from the event URL of Google Calendar using Google Apps Script.

The event URL is like https://www.google.com/calendar/event?###. At the event URL, ### of https://www.google.com/calendar/event?### is not the event ID. So it is required to convert it.

Sample script

var eventUrl = "https://www.google.com/calendar/event?###";
var eventId = Utilities.newBlob(Utilities.base64Decode(eventUrl.split("=")[1]))
  .getDataAsString()
  .split(" ")[0];
Logger.log(eventId);

 Share!