How can I find the Event Id of my Google Calendar event?
Asked Answered
R

9

28

I created some Google Calendar events and now I would like to do some operations on them programmatically.

Trouble is I don't have their IDs.

When I go into the calendar and click on the event, there is nowhere where I can see the ID.

Does anyone know where I can find it?

Ranket answered 24/9, 2015 at 7:9 Comment(3)
events.list is probably the easiest way. developers.google.com/google-apps/calendar/v3/reference/events/…Vaginitis
that reference does not apply to apps script.Kat
@ZigMandel: It now does because there is an advanced API, and in fact this is the only way I've found to easily get the eventId properly.Circadian
O
40

On The Google Calendar Website

Since he originally asked how to click into the calendar and find the ID of a particular event, and since that's what I needed to know how to do too:

  1. Click the event in your Google Calendar.

  2. It will take you to a page with a URL such as https://calendar.google.com/calendar/render?pli=1#eventpage_6%7Ceid-NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw-1-0-

  3. Look for "eid" in the URL.

  4. Select and copy the string between eid- and the next -. (In my example here, it is NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw.)

  5. Now you need to decode from Base64 format. You could paste that string into a tool such as https://www.base64decode.org/.

  6. The result will be two strings separated by a space. The first string is your Event ID.

Ossuary answered 26/9, 2017 at 13:56 Comment(1)
Clicking the event now opens a dialog, but one can get the link by "︙" > Publish Event > Link to eventOctaviooctavius
M
41

There is another way to see that Event Id.

  1. Go to the event debugging URL at https://www.google.com/calendar/render?gsessionid=OK&eventdeb=1
  2. Double click to view the affected event.
  3. Select the drop down menu 'More Actions'.
  4. Click on the 'Troubleshooting Info'.
  5. Copy the text that appears and paste it in your reply to support.

Source: http://googleappstroubleshootinghelp.blogspot.com/2012/09/how-to-find-troubleshooting-information.html

Malefic answered 6/8, 2018 at 9:43 Comment(2)
Some usages require that you append @google.com to the end of the event id. See this question for more details.Circadian
This is excellent! If you want the id programmatically though, see this answer.Circadian
O
40

On The Google Calendar Website

Since he originally asked how to click into the calendar and find the ID of a particular event, and since that's what I needed to know how to do too:

  1. Click the event in your Google Calendar.

  2. It will take you to a page with a URL such as https://calendar.google.com/calendar/render?pli=1#eventpage_6%7Ceid-NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw-1-0-

  3. Look for "eid" in the URL.

  4. Select and copy the string between eid- and the next -. (In my example here, it is NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw.)

  5. Now you need to decode from Base64 format. You could paste that string into a tool such as https://www.base64decode.org/.

  6. The result will be two strings separated by a space. The first string is your Event ID.

Ossuary answered 26/9, 2017 at 13:56 Comment(1)
Clicking the event now opens a dialog, but one can get the link by "︙" > Publish Event > Link to eventOctaviooctavius
N
11

There is one other quick and easy approach.

  • Click on the event in your calendar. It doesn't need to be in debug mode.
  • From the URL, copy the string between the last slash and the question mark.
  • Paste this string into a base64 encoder. (https://www.base64decode.org/)
  • You will get the event ID and the email of the calendar owner (you?).
  • (The eventId is the first string of characters.)
Nadenenader answered 22/1, 2019 at 17:51 Comment(0)
E
1
  • get the cal
  • loop thru all events during the time period in question
function myFunction() {
  var cal = CalendarApp.getCalendarById(id);
  var events = cal.getEvents(startTime, endTime);
  for ( var i in events ) {
    var id = events[i].getId();
  }
}
Escalante answered 24/9, 2015 at 7:46 Comment(0)
C
1

TL;DR

You should use the advanced API for this.

Calendar.Events.list(calendarId).items[0].id; // returns the id of the first event

If you just want the event ID for a specific event and are fine using a manual approach, then eventdeb=1 is your best bet.

If you want a programmatic solution, note that you cannot use the standard API (CalendarApp) because the documentation for getId() on a CalendarEvent states:

Gets the unique iCalUID of the event. Note that the iCalUID and the event id used by the Calendar v3 API and Calendar advanced service are not identical and cannot be used interchangebly. One difference in their semantics is that in recurring events all occurrences of one event have different ids while they all share the same iCalUIDs.

This means if you want to construct a URL for a recurring event, you'll run into issues because you can't use getId() properly, especially for recurring events. The best fix is to use the Advanced Calendar API. (Also note that if you're trying to construct a link to the calendar event, the advanced API even has an htmlLink property with the encoded calendarId + realEventId.


Here are some more details as to why getId() it breaks for recurring events: This is because when you call event.getId() on an event that is repeating, you get the same id. There is no way to reference a specific instance of the calendar event using the simple Calendar API. The URL is still able to reference a specific instance of the event by appending a format such as _20190626T000000Z. However, it's not clear what values need to be provided there. There are also cases where _ is replaced with _R and Z replaced with @google.com, further complicating matters.

To prove this is a problem:

  1. Find a repeating calendar event.
  2. Parse its URL (which is guaranteed to refer to the specific instance).
  3. Call CalendarApp.getEventById(parsedId1).getId() notice the value that is returned.
  4. Now parse a URL for a different instance of the event.
  5. Call CalendarApp.getEventById(parsedId2).getId() notice the value that is returned. Although parsedId1 and parsedId2 are different strings (referring to the specific instances), the returned value of getId() on both of those is the same. The event is actually a reference to the specific instances, but you can't serialize their IDs anymore.

If you really want to use the simple calendar API, you'll likely need some kind of synchronization process and to store metadata/tags on each instance of the calendar events during as alluded to in this answer. However, the Advanced API will make your life a lot easier.

Circadian answered 24/6, 2019 at 18:19 Comment(0)
A
0

The simple answer is eventId = event.get('id'). You didn't ask about the event object but as a guide to others this is how I created it for my Google Calendar python script:

creds = get_credentials()
http = creds.authorize(httplib2.Http())
calendar_service = discovery.build('calendar', 'v3', http=http)
event = calendar_service.events().insert(calendarId='primary', 
body=event).execute()

then

eventId = event.get('id')
Archegonium answered 14/4, 2017 at 16:55 Comment(0)
S
0

You can directly retrieve the id when you create it, you'll need to import base64:

 event = {
  'summary': 'Google I/O 2015',
  'location': '800 Howard St., San Francisco, CA 94103',
  'description': 'A chance to hear more about Google\'s developer products.',
  'start': {
    'dateTime': '2015-05-28T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  },
  'end': {
    'dateTime': '2015-05-28T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  },
  'recurrence': [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  'attendees': [
    {'email': '[email protected]'},
    {'email': '[email protected]'},
  ],
  'reminders': {
    'useDefault': False,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10},
    ],
  },
}

event = service.events().insert(calendarId='primary', body=event).execute()

print(event['id'])

Seduction answered 3/3, 2021 at 17:53 Comment(0)
D
0

Go to Calendar and click on event and it shows you popup like below

enter image description here

Now click on the edit icon, it redirects to a page then from the url find eventedit after this parameter you can see event id. URL looks likes below

https://calendar.google.com/calendar/u/0/r/eventedit/OGM1dnRlODY4azBzMWtjdThzMmo3NmM2OWNfMjAyMTEwMjhUMTYwMDAwWiBuNXUzMTk5NTFyYjI18555FsdZwdWE4dWExb0Bn?pli=1
Dionedionis answered 6/10, 2021 at 11:55 Comment(1)
I think the eventId in this is encoded (base64) and you still need to use the approach from accepted answer to decode it. Otherwise, you can't use that string to communicate with Google Calendar API (like update events or delete them etc). In other words this isn't a full answer.Hyps
P
0

An easy way to get all event IDs for any calendar in any app is to just export your calendar to ICS. in the calendar.ics file, every entry will have a UID. This is your event ID! This even works if someone books a meeting with you using Google Calendar and you're using Outlook or Hotmail or anything else, you still get their event ID, you just need to export to ICS format to see it :)

Pitman answered 24/10, 2023 at 20:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.