← Calendar Autopilot · Guides
How to avoid duplicate Google Calendar™ events from a Google Sheets™ spreadsheet
Updated November 24, 2026
You add your rows from Google Sheets™ to Google Calendar™, make a few changes, run it again, and now every appointment is there twice. Duplicates almost always have the same root cause: the method that creates events has no memory of which events it already made. Fix that and the duplicates stop.
Why duplicates happen
- Re-importing a CSV. Google says imported events "don't stay in sync" (Google's import page). Calendar treats each import as new events, so importing an updated version of the same file adds every row again.
- A script with no record of what it made. A script that loops over every row and calls
createEventmakes a fresh set each time it runs. On an hourly timer, that's a new copy of your schedule every hour. - Tracking by row number. Some scripts remember "row 5 is done." Sort the sheet or insert a row above, and row 5 is now a different appointment. The old one gets created again and the new one gets skipped or overwritten.
- Tracking by title. Matching on the event name breaks when two rows share a name ("Staff meeting" every Monday) or when you fix a typo in the title.
- Copying rows that include an ID. If your sheet stores an event ID per row and you copy a row to make a similar one, both rows now claim the same event.
The fix: one event ID per row
Give the sheet a column that holds each row's event ID, written the moment the event is created. Then every run follows two rules: a row with an ID is never created again, and a row without an ID is created once and gets one. In Google Apps Script™, the ID comes from the event itself:
var ev = cal.createEvent(title, start, end);
sheet.getRange(row, idColumn).setValue(ev.getId());
Google's event reference describes getId() as the event's unique iCalUID. Later runs can look the event up with CalendarApp.getEventById(id) and update it instead of creating another one. A few habits keep it working:
- Never type in the ID column, and consider hiding it so nobody edits it by accident.
- Clear the ID when you copy a row to make a new appointment, so the copy gets its own event.
- Keep the ID on the same row as its data. When you sort, select all the columns, including the ID column, so the ID moves with its row.
- Store the ID before anything else can go wrong. If the script stops after creating an event but before saving its ID, the next run creates it again. Save it right after each create, not at the end.
For CSV imports: import only what's new
A CSV import can't update events, so the only ways to avoid doubles are:
- Keep an "Imported" column, mark rows TRUE after each import, and export only the rows that are still FALSE next time (a filter view or
=FILTER(...)on a separate tab works well). - Or import into a calendar used only for this list. When the list changes, delete that calendar (its settings page: Remove calendar, then Delete, per Google's steps), create a new one and import the full list again. Note that this also removes anything people added to those events by hand.
Cleaning up duplicates you already have
A handful: search Calendar for the title (Search at the top right, Google's steps), open each extra copy and click Delete event. Deleted events go to the Trash under Settings, where Google keeps them for 30 days in case you remove the wrong one (Google's page).
Hundreds: a short script can find events with the same title and start time in a date range and delete all but one. Run it with the delete line commented out first and read the log, so you see exactly what it would remove:
function removeDuplicates() {
var cal = CalendarApp.getDefaultCalendar();
var events = cal.getEvents(new Date('2026-01-01'), new Date('2027-01-01'));
var seen = {};
events.forEach(function (ev) {
if (ev.isRecurringEvent()) return; // leave repeating events alone
var key = ev.getTitle() + '|' + ev.getStartTime().getTime() + '|' + ev.getEndTime().getTime();
if (seen[key]) {
Logger.log('Duplicate: ' + ev.getTitle() + ' ' + ev.getStartTime());
// ev.deleteEvent();
} else seen[key] = true;
});
}
Be careful with events that should legitimately repeat at the same time on the same day (two rooms booked for "Interview" at 10:00, for example). Add the location to the key if that applies to you.
Calendar Autopilot was built around the event-ID rule. It adds a hidden column named "Autopilot row ID (do not edit)" and tags each event with the same ID, so sorting the sheet, running sync twice or editing a title still gives one event per row. When you copy a row, it notices the repeated ID and gives the copy a fresh one. And if two events ever end up tagged to the same row, the next sync keeps one and removes the extra. It only ever looks at events its own rows created, so it won't touch duplicates that were made some other way; clean those up first with the steps above.
One row, one event
Calendar Autopilot ties every row to its own Google Calendar™ event, previews each sync before it runs, and can undo any of your last 20 syncs. Syncing by hand is free on any sheet; automatic sync is free on 1 sheet (first 100 rows). Install from Google Workspace Marketplace™ · Learn about Calendar Autopilot.
Google Sheets™, Google Calendar™, Google Apps Script™ and Google Workspace Marketplace™ are trademarks of Google LLC. Calendar Autopilot is made by Coding Friend LLC and is not affiliated with or endorsed by Google.