How to Create Google Calendar Events from Google Sheets

How to Create Google Calendar Events from Google Sheets
Reading Time: 3 minutes

Final Output

Get Google Calendar Events from Google Sheets

Learn how to create Google Calendar events from Google Sheets.

Introduction

Event planning is something that takes a lot of time. Creating bulk calendar events for tracking employee performance and coordinating meetings is a tedious task.

Let’s say you have a college cultural festival in the last week of February. You want to create a calendar planner for all the events for a particular day. Creating these events manually on Google Calendar takes a lot of time. If you have the start time, end time and Event names ready on a Google Sheet, you can connect that sheet with Google Calendar to generate the events automatically.

You can link Google Sheets with Google Calendar simply by using Google Apps Script. If you are new to Google Apps Script, go through How to Create a Google Apps Script in Google Sheets to get familiar with the topic. You’ll learn how to create Google Calendar events from Google Sheets using Google Apps Script.

How to Create Google Calendar Events from Google Sheets using Google Apps Script?

Step 1: Create a Schedule or Event

  • Open Google Calendar.
  • Create new calendar..
Figure 1: Create new calendar event
Figure 1: Create new calendar event
  • Enter the Name of Event and click on Create Calendar.
Figure 2: Create new calendar
Figure 2: Create new calendar
  • Go to Calendar Setting –> Calendar ID.
  • Copy the Calendar ID for future reference.
Copy the calendar ID
Figure 3: Copy the calendar ID

Step 2: Add details of the event to a Google Sheets

  • Enter the timings and events into Google Sheets as shown below
Details of events in Google Sheet
Figure 4: Details of events in Google Sheet

Step 3: Select Apps Script

  • Navigate to the Extensions option.
  • Select Apps Script.
Open Google Apps Script
Figure 5: Open Google Apps Script

Step 4: Copy the script 

  • Copy and paste the script mentioned below:
function scheduleShifts() {var spreadsheet = SpreadsheetApp.getActiveSheet();
    var calendarID = spreadsheet.getRange("C4").getValue();
    var eventCal = CalendarApp.getCalendarById("calendarId");var signups = spreadsheet.getRange("A7:C15").getValues();for (x=0; x<signups.length;x++)
{
    var shift = signups[x];
    var startTime = shift[0];
    var endTime = shift[1];
    var volunteer= shift[2];
    eventCal.createEvent(volunteer, startTime, endTime);
}
}
  • Change the calendar id. (How to extract calendar id was taught in 1st step.
  • Now Run the script.
Code on how to create Google Calendar Events from Google Sheets
Figure 6: Code on how to create Google Calendar Events from Google Sheets

Step 5: Give Authorization to the script

  • As soon as you run the script, Google Apps Script will ask for authorization.
Grant Review Permissions
Figure 7: Grant Review Permissions
  • Grant the permissions to access your Google Account.

Step 6: Calendar Event created Successfully

  • Calendar events are created successfully.
  • This is how you create Google Calendar events from Google Sheets.

See Also

How to import JSON in Google Sheets | Easy guide: In this article we will see how to import JSON in Google Sheets using the Apps Script Editor.

Most Commonly Used Google Script Functions in Google Sheets for 2022: Learn about the most commonly used Google Script functions in Google Sheets.