Skip to content
Logo Yamm

Using Google Calendar API to Create Events with Google Meet and Apps Script

Google Sheets connected through Apps Script to Google Calendar and Meet.
Table of contents

Welcome to the second part of the Calendar API Tutorial Series.

In this blog, I am going to show you how to use Google Calendar API to create Events with Google Meet links and Google Apps Script.

So let’s get started.

Google Calendar API Tutorial: How to Add Event to Google Calendar with API

If you prefer to watch a video of this Google Calendar API tutorial instead of reading, we've got you covered:

The video uses an older interface. Follow the updated written steps below for the current menus and complete script.

Step 1: Sample Google Sheet

Create a Google Sheet with a tab named Calendar_Events. Put these five headers in columns A–E and add your events below them. This copyable example leaves attendees blank so your first test does not invite anyone.

TitleStart timeEnd timeDescriptionAttendees
YAMM tutorial demo2026-10-05T09:00:00+02:002026-10-05T09:30:00+02:00Test event created from Google Sheets

Use your own dates. For text timestamps, include the timezone offset, as in the example. Date/time cells also work; check the spreadsheet's timezone. To invite guests later, enter their email addresses in column E, separated by commas. The script sends invitations when that column is populated.

Step 2: Documentation: Adding the Google Calendar API to create event

  1. In the spreadsheet, select Extensions → Apps Script.
  2. In the Apps Script editor, next to Services, select Add a service (+).
  3. Select Google Calendar API, keep version v3 and the identifier Calendar, then select Add.
Apps Script Add a service dialog with Google Calendar API selected, version v3, and identifier Calendar.

With Apps Script's default Google Cloud project, adding the service also enables the API. If you use a standard Cloud project, enable the Calendar API there too. See Google's advanced-service setup instructions.

Step 3: Write the Automation Script to Create Calendar Event

Paste this complete script into the editor. Replace YOUR_CALENDAR_ID with the ID of a calendar you can edit, found in that calendar's Settings → Integrate calendar section. Use a separate test calendar for your first run.

The file-level @OnlyCurrentDoc annotation limits the Spreadsheet service permission to the spreadsheet containing this script. The code only reads its event rows; separate Calendar permissions are still required.

/**
 * @OnlyCurrentDoc
 */

function createNewEventWithMeet() {
  const calendarId = 'YOUR_CALENDAR_ID';
  const sheet = SpreadsheetApp.getActiveSpreadsheet()
    .getSheetByName('Calendar_Events');
  if (!sheet) throw new Error('Create a sheet named Calendar_Events first.');
  if (sheet.getLastRow() < 2) throw new Error('Add at least one event row.');

  const rows = sheet.getRange(2, 1, sheet.getLastRow() - 1, 5).getValues();
  const events = rows.flatMap((row, index) => {
    if (row.every(value => value === '')) return [];
    const [title, start, end, description, guests] = row;
    const rowNumber = index + 2;
    const startDate = parseEventDate(start, rowNumber);
    const endDate = parseEventDate(end, rowNumber);
    if (!String(title).trim() || endDate <= startDate) {
      throw new Error(`Check the title and start/end times in row ${rowNumber}.`);
    }
    const emails = String(guests || '').split(',')
      .map(email => email.trim()).filter(Boolean);
    if (emails.some(email => !/^[^@\s<>]+@[^@\s<>]+\.[^@\s<>]+$/.test(email))) {
      throw new Error(`Use comma-separated email addresses in row ${rowNumber}.`);
    }
    const attendees = emails.map(email => ({ email }));
    return [{
      summary: String(title).trim(),
      description: String(description || ''),
      start: { dateTime: startDate.toISOString() },
      end: { dateTime: endDate.toISOString() },
      ...(attendees.length ? { attendees } : {}),
      conferenceData: {
        createRequest: {
          requestId: Utilities.getUuid(),
          conferenceSolutionKey: { type: 'hangoutsMeet' },
        },
      },
    }];
  });

  if (!events.length) throw new Error('Add at least one event row.');

  // Validate all rows and check Meet support before creating any events.
  const calendar = Calendar.Calendars.get(calendarId);
  const solutions = calendar.conferenceProperties?.allowedConferenceSolutionTypes || [];
  if (!solutions.includes('hangoutsMeet')) {
    throw new Error('Google Meet is not available for this calendar. Choose a supported calendar.');
  }
  events.forEach(resource => {
    const event = Calendar.Events.insert(resource, calendarId, {
      conferenceDataVersion: 1,
      sendUpdates: resource.attendees ? 'all' : 'none',
    });
    console.log(`${event.summary}: ${event.htmlLink}`);
  });
}

function parseEventDate(value, rowNumber) {
  if (value instanceof Date) {
    if (Number.isNaN(value.getTime())) {
      throw new Error(`Invalid date/time in row ${rowNumber}.`);
    }
    return value;
  }

  const timestamp = String(value).trim();
  const parts = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/.exec(timestamp);
  if (!parts) {
    throw new Error(`Use a date/time cell or an ISO timestamp with a timezone in row ${rowNumber}.`);
  }
  const day = new Date(`${parts[1]}T00:00:00Z`);
  const date = new Date(timestamp);
  // Date parsing can silently normalize impossible dates such as February 30.
  if (Number.isNaN(day.getTime()) || Number.isNaN(date.getTime()) ||
      day.toISOString().slice(0, 10) !== parts[1] ||
      Number(parts[2]) > 23 || Number(parts[3]) > 59 || Number(parts[4] || 0) > 59) {
    throw new Error(`Invalid date/time in row ${rowNumber}.`);
  }
  return date;
}

The script reads columns A–E and checks every row's title, dates, time order, and basic attendee email format before inserting any events. It rejects impossible dates such as February 30, converts valid dates to ISO timestamps, and skips empty rows. Enter plain email addresses without display names in column E. The script does not read a visibility column; events use the calendar's default visibility.

Google Meet API create meeting:

The conferenceData.createRequest object requests a new Google Meet conference for each event. Utilities.getUuid() creates a unique request ID, and conferenceDataVersion: 1 tells the Calendar API to process conference data.

Google Meet can be used with supported primary or secondary calendars. Before creating events, the script checks that the selected calendar advertises hangoutsMeet in conferenceProperties.allowedConferenceSolutionTypes. See Google's conference-creation guidance. Conference creation is asynchronous: if the link is not ready, reopen the event shortly afterward and check again.

Step 4: Run the script and check the created event

Optional: set narrower permissions explicitly before running. To avoid broader automatically detected Calendar permissions, set the three scopes below in the project manifest:

  1. Open Project Settings and enable Show "appsscript.json" manifest file in editor.
  2. Return to Editor, open appsscript.json, and add or replace only its top-level oauthScopes array with the array below. Preserve all other fields, including the enabled Calendar v3 service, runtime, and timezone.
  3. Save, then check Overview → Project OAuth Scopes.
{
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/calendar.calendars.readonly",
    "https://www.googleapis.com/auth/calendar.events"
  ]
}

These scopes permit access to the current spreadsheet, reading calendar properties to check Meet support, and viewing or editing Calendar events. Calendar event access is not limited to the ID in this script: it covers calendars your account can access, with changes allowed only where you have editing permission. See Google’s manifest instructions and Calendar scope descriptions.

Save the script, select createNewEventWithMeet from the function selector, then select Run. On the first run, review Google's authorization prompt for the spreadsheet and calendar access the script needs.

Apps Script toolbar with createNewEventWithMeet selected beside Run and the tutorial code below.

Open the event link in the execution log, or find the event in Google Calendar. Check its title, time and Google Meet link. If you entered attendees, check that the intended guests were added.

Example Calendar event with a Google Meet link.
Example Calendar event with a Google Meet link. This event was created manually for the illustration.

Each run creates new events, so running the same rows again creates duplicates. Input checks happen before insertion, but an API error can still stop a run after earlier events were created; inspect the calendar before retrying. Keep attendees blank while testing. After checking the result, you can use the same approach to create events in a shared calendar you have permission to edit.

Summary of how to use Google Calendar API to create events

We saw how you can Create Calendar Events with Google Meet link using the Calendar API and Google Apps Script. To sum up :

  1. Prepare five columns in the Calendar_Events sheet.
  2. Enable the advanced Calendar service in Apps Script.
  3. Read and validate the event rows.
  4. Convert dates to ISO timestamps and select the destination calendar.
  5. Request a unique Google Meet conference for each event.
  6. Create the events and verify the results in Google Calendar.

I hope you have understood how to use Google Calendar API to Create Events with Google Meet link and Google Apps Script.

Hope you enjoyed the series and learned about the Calendar API. Feel free to reach out if you have any issues/feedback at aryanirani123@gmail.com.

Join 150,000 organizations and 10+ million users

DropboxAirbnbUberGoogleHarvard
WhirlpoolIndeedVeoliaThe EconomistSolvay
Get started
Copyright © 2026 Talarian Sàrl All rights reserved.
yamm-isoyamm-gdpryamm-gcp