In Google Calendar, is it possible to change the color of multiple events at once? Preferably a solution that would work on Android.

  • If you're looking for a solution that works in the Android app, you're on the wrong site. You want Android Enthusiasts. This site is only appropriate for questions about the web interface.
    – ale
    Aug 16, 2016 at 13:01

1 Answer 1


Here is the code you're looking for (using Google Apps Script and the Google Calendar API). Note that you'll have to enable the Google Calendar API to use it (see the instructions below):

function myFunction() {


  var calendar = "Test"; //The name of the calendar you want to modify (WITH quotes)

  var startDate = new Date("Jan 10 PST 2016"); //The start of the time range in which the events exist

  var keyword = "Blue"; //The keyword to search for in the event title (WITH quotes; IS case-sensitive)

  var where = 1;        //Where to search for events (0 = title; 1 = description)

  var color = "blue"; //The color to change the events to (WITH the quotes)


  var calendarId = CalendarApp.getCalendarsByName(calendar)[0].getId();

  var optionalArgs = {
    timeMin: startDate.toISOString(),
    showDeleted: false,
    singleEvents: true,
    orderBy: 'startTime'

  var service = Calendar.Events;
  var response = Calendar.Events.list(calendarId, optionalArgs);
  var events = response.items;

  for (i = 0; i < events.length; i++) {    

    if (where == 0)
      var searchResult = events[i].summary.search(keyword);
    else if (where == 1){
      if (events[i].description == undefined)

      var searchResult = events[i].description.search(keyword);

    if (searchResult > -1){

      if (color == "bold blue")
        events[i].colorId = 9;
      else if (color == "blue")
        events[i].colorId = 1;
      else if (color == "turquoise")
        events[i].colorId = 7;
      else if (color == "green")
        events[i].colorId = 2;
      else if (color == "bold green")
        events[i].colorId = 10;
      else if (color == "yellow")
        events[i].colorId = 5;
      else if (color == "orange")
        events[i].colorId = 6;
      else if (color == "red")
        events[i].colorId = 4;
      else if (color == "bold red")
        events[i].colorId = 11;
      else if (color == "purple")
        events[i].colorId = 3;
      else if (color == "gray")
        events[i].colorId = 8;

        service.update(events[i], calendarId, events[i].id);

If you want to jump straight to a program that you can just copy to your Google Drive, here is one I already have other people using: https://script.google.com/d/1RwZIYI_IYEaiTco1JerkTJjyAhLYqpwluqkoBYmqxiYLLGtoTQaT67r3/edit?usp=sharing

And here are the steps to get it working (stay with me- it'll get a bit involved):

  1. When you first click on the link, click in the menu "File" > "Make a copy..." and make a copy to your Google Drive
  2. Click in the menu "Resources" > "Advanced Google services..."
  3. In the dialog box that pops up, make sure that for "Calendar API" the switch on the right is switched to "on"
  4. In that same dialog box, click the "Google Developers Console" link
  5. On the right side under the category "Google Apps APIs", click "Calendar API"
  6. At the top under "Overview", click "Enable API"
  7. You can now close this tab and return to the original script
  8. In the code, change line 6 to be the name of your calendar (remember to keep the quotes)
  9. Change line 8 to reflect what date the events start on and change "PST" to your timezone (keep the same formatting)
  10. Change line 10 to be a keyword you want to match or "" to select all the events in the calendar after the date in line 8 (remember this is a case-sensitive match)
  11. Change line 12 to be "0" or "1" depending on whether you want to search for the keyword in the title (0) or in the description (1) of events
  12. Change line 14 to be the color to change to (all lower-case). This is defined by the tool tip shown when editing an event (e.g. http://i.imgur.com/hlHCW3x.png)
  13. Finally, once you're all set with the above steps, click in the menu "Run" > "myFunction" (you may have to authorize the script to modify your calendar the first time)
  • this script is great. thanks so much!!!
    – manishie
    May 10, 2017 at 2:00
  • Derek, I can't get this to work - it just says "TypeError: Cannot call method "getId" of undefined. (line 41, file "Code") Has something changed since you first published this?
    – Sean A.
    Jan 11, 2019 at 21:29
  • @SeanA likely whatever you put in for your calendar name is not what Google actually recognizes as the name of one of your calendars. You can use this script to get a list of your calendars as Google knows them: script.google.com/d/… Jan 12, 2019 at 21:14