TriggerShelf

Recipe

Create Google Calendar events from a Sheet

Trigger: Run from the editor or a time-driven triggerServices: SpreadsheetApp, CalendarAppMock-tested: Nov 2026

Creates a calendar event for each row with a title, start and end, then writes the event ID back so the row is never added twice.

Set it up

  1. Make columns A Title, B Start, C End, D Notes, E Event ID. Use real date-time cells in B and C.
  2. Paste the script into Extensions > Apps Script and save.
  3. Run createEvents and approve the prompts. New rows are added on each run.

The script

/**
 * Create Calendar events from sheet rows.
 * Columns: A Title, B Start (date-time), C End (date-time), D Notes, E Event ID (filled by the script).
 * Run createEvents from the menu or a trigger. Rows with an Event ID are skipped.
 */
var CE = { sheetName: 'Sheet1', idCol: 5 };

function createEvents() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(CE.sheetName);
  var values = sheet.getDataRange().getValues();
  var calendar = CalendarApp.getDefaultCalendar();
  var created = 0;
  for (var i = 1; i < values.length; i++) {
    var row = values[i];
    if (row[CE.idCol - 1] || !row[0]) continue;
    var start = new Date(row[1]);
    var end = new Date(row[2]);
    if (isNaN(start) || isNaN(end) || end <= start) {
      sheet.getRange(i + 1, CE.idCol).setValue('Check dates');
      continue;
    }
    var event = calendar.createEvent(String(row[0]), start, end, { description: String(row[3] || '') });
    sheet.getRange(i + 1, CE.idCol).setValue(event.getId());
    created++;
  }
  return created;
}
Test status. 3 of 3 automated checks pass, run Nov 2026 against simulated Google services. This recipe has not yet been run inside a live Google account. Test it on a copy of your sheet first.

What you should see

TitleStartEndEvent ID
Team syncNov 18 10:00Nov 18 10:30a1b2c3d4e5
Audit prepNov 19 14:00Nov 19 15:00

Event IDs are written back. Sample values, not output from a real account.

Common errors and fixes

Check dates appears in column E
Start or End is not a date, or End is not after Start.
Events land at the wrong hour
Check the spreadsheet time zone and the calendar time zone.
Exception: Cannot find calendar
The account has no default calendar. Open Google Calendar once, then retry.

Permissions. Running this script asks you to grant Google permissions for the services listed above, to your own script. TriggerShelf never receives your Google data. See the permissions table. Google will show "Google hasn't verified this app"; that is expected for a script you paste yourself.