Source: https://oguzerol.com/en/google-sheets-calendar-sync-app/
[ View full size](https://oguzerol.com/gorseller/hizmet-kapaklari/google-sheets-takvim-senkronizasyonu-webapp-v1-en.webp)
# Google Sheets to Google Calendar Sync: Maintenance Plans Without Duplicates
[Oğuz Erol](https://oguzerol.com/en/about-me/) | 13 min read
To send maintenance plans, service appointments or delivery dates from Google Sheets to Google Calendar and keep events current as dates change, the most reliable way is for each row to hold its event’s ID. **CSV import** suits a one-off plan but does not update existing events. **Apps Script** creates one event per row; with the ID written back, a changed date updates the same event, a cancellation deletes it, and no duplicates appear. On both, calendar edits do not flow back to the sheet. Integration tools and a custom web application are the table’s other two routes; the latter fits when planning needs roles, conflict checks, customer notices and history.
## Which approach when?
| Approach | When | Limit |
| --- | --- | --- |
| CSV import | Plan made once, rarely changed | No updates; re-import duplicates |
| Integration tool | Few fields, one direction (untested) | IDs, error alerts and account depend on the tool’s setup |
| Apps Script with IDs | Plan changes often, one planner | Runs under the installer’s account |
| Web application | Roles, conflicts, customer notices, history | Written scope, server, maintenance |
This page covers Google Calendar only; I have not tested syncing to Outlook or Microsoft 365.
## Example: 40 machines, 146 maintenance visits, 26 weeks
Company and figures are fictional, from a Python simulation. A compressor and refrigeration service company plans maintenance for 40 machines at customer sites: 16 every 4 weeks, 18 every 13, 6 every 26. A 26-week plan holds 146 visits, one row each (from BK-001); 93 timed, 53 all-day. Technicians follow a shared calendar.
Customers rescheduled 23 visits, 9 changed technician, 5 were cancelled as machines left service. BK-016 (compressor K-03, every 4 weeks) moved from Week 7 Friday 09:00 to Week 8 Tuesday 13:00. Technicians also moved 5 events in the calendar.
| Same 26 weeks | Manual CSV (simulated, assumed rates) | ID-based sync (simulated) |
| --- | --- | --- |
| Duplicate events | 6 | 0 |
| Changes never reaching the calendar | 1 | 0 |
| Cancelled but still in calendar | 0 | 0 |
| Manual calendar operations | 62 | 0 |
| Moved in calendar, differing from sheet | 4 | 4 (+1 awaiting decision) |
From 32 changes (23 + 9), the 62 operations: 1 first import + 6 re-imports without deleting the old event + 25 × 2 deletions and re-imports + 5 cancellation deletions. Assumed, not measured: deleting the old event is forgotten for 20% of changes that reach the calendar, 10% never reach it, 20% of cancelled events stay (none did here). The rates were drawn randomly in the simulation; the table shows that draw. Care cuts errors, not the 62 operations.
## 1. CSV import: fine for a one-off plan
Google Calendar imports CSV rows as events, but its import page does not say re-importing updates existing events. Download with **File > Download > Comma Separated Values (.csv)**, then in Google Calendar on a computer use **Settings > Import & export**. Google’s [import page](https://support.google.com/calendar/answer/37118?hl=en) (read 2026-10-31):
- Headers must be in English. Only `Subject` and `Start Date` are required; optional ones are `Start Time`, `End Date`, `End Time`, `All Day Event` (True/False), `Description`, `Location`, `Private`.
- Events go to your primary calendar unless you choose another.
- Repeating events may arrive as a series of one-time events.
- Guests and conference data are not imported.
- No date format rule; the example uses `05/30/2020` and `10:00 AM`. Test day-first dates (`30/05/2020`) on one row first.
The example plan’s CSV in that month/day/year form (Week 1 Monday taken as 11/02/2026):
```
Subject,Start Date,Start Time,End Date,End Time,All Day Event,Location
BK-001 K-01 · Technician 1,11/03/2026,,11/03/2026,,True,Site 1
BK-016 K-03 · Technician 2,12/18/2026,9:00 AM,12/18/2026,11:00 AM,False,Site 3
```
CSV has no event ID column, so nothing matches a second “BK-016” row to the first event. I assume re-importing a changed row creates a new event (Google does not say); hence the 6 duplicates.
CSV suits a rarely changing plan fixed by one person. Import into a separate, empty calendar; deleting it undoes a bad import.
## 2. When are integration tools enough?
Integration tools such as Zapier and Make have Google Sheets and Google Calendar connections (as of 2026-10-31); I have not tested which triggers and actions they offer. For few fields, one way, they can work without code. Ask: is the event ID written back to the row, does a date change update the same event, whose account holds the connection, who hears about a failed step? If even one has no clear answer, the duplicate risk may approach CSV’s (my inference).
## 3. Apps Script: one event per row, with the ID written back
CalendarApp creates an event per row and returns its ID; a script that stores it can update the same event later. Per Google’s [CalendarApp reference](https://developers.google.com/apps-script/reference/calendar/calendar-app), `getEventById` returns `null` if the event does not exist or is inaccessible, and on a non-default calendar the lookup runs on that calendar.
You can hand this section to your developer; I have not run the code, and the rules below explain it. The `Plan` tab holds A Job code, B Machine, C Site, D Technician, E Date, F Time (blank = all day), G Duration (hours), H Status. Only the script writes I–L: event ID, last sent row state (signature), event last-updated time, note.
```
// Test it first on a copy of the sheet and an empty test calendar.
var SHEET = 'Plan';
var CALENDAR_ID = 'xxxxxxxx@group.calendar.google.com';
function syncToCalendar() {
var lock = LockService.getScriptLock();
if (!lock.tryLock(30000)) return; // exit if a previous run is still going
try {
var ss = SpreadsheetApp.getActive();
if (ss.getSpreadsheetTimeZone() !== Session.getScriptTimeZone()) {
throw new Error('Spreadsheet and script time zones differ');
}
var cal = CalendarApp.getCalendarById(CALENDAR_ID);
if (!cal) throw new Error('Calendar not found or this account has no access');
var sheet = ss.getSheetByName(SHEET);
var n = sheet.getLastRow() - 1;
if (n < 1) return;
var range = sheet.getRange(2, 1, n, 12);
var v = range.getValues(), d = range.getDisplayValues();
for (var i = 0; i < n; i++) {
try { syncRow(cal, sheet, i, v[i], d[i]); }
catch (e) { flag(sheet, i, 'Error: ' + e.message); }
}
} finally {
lock.releaseLock();
}
}
function syncRow(cal, sheet, i, r, d) {
if (r[0] === '') return;
var sig = d.slice(0, 8).join('|'); // A-H
if (sig === r[9]) return; // unchanged row
var ev = r[8] ? cal.getEventById(r[8]) : null;
if (r[7] === 'Cancelled') {
if (ev) ev.deleteEvent();
return write(sheet, i, '', sig, '', ev ? 'Cancelled: deleted' : 'Cancelled: not in calendar');
}
if (r[8] && !ev) return flag(sheet, i, 'Not found in calendar');
if (ev && typeof r[10] === 'number' && ev.getLastUpdated().getTime() > r[10]) {
return flag(sheet, i, 'Edited in calendar, not updated');
}
if (!(r[4] instanceof Date)) return flag(sheet, i, 'No date');
var time = d[5].match(/^(\d{1,2}):(\d{2})/);
if (d[5] !== '' && !time) return flag(sheet, i, 'Time is not HH:MM');
var title = r[0] + ' ' + r[1] + ' · ' + r[3];
var t = r[4], isNew = !ev;
if (!time) {
if (ev) ev.setAllDayDate(t); else ev = cal.createAllDayEvent(title, t);
} else {
var start = new Date(t.getFullYear(), t.getMonth(), t.getDate(), Number(time[1]), Number(time[2]));
var end = new Date(start.getTime() + (Number(r[6]) || 2) * 3600000);
if (ev) ev.setTime(start, end); else ev = cal.createEvent(title, start, end);
}
if (isNew) {
sheet.getRange(i + 2, 9).setValue(ev.getId()); // write the ID at once
SpreadsheetApp.flush();
} else {
ev.setTitle(title);
}
ev.setLocation(String(r[2]));
write(sheet, i, ev.getId(), sig, ev.getLastUpdated().getTime(), 'Up to date');
}
function write(sheet, i, id, sig, updated, note) {
sheet.getRange(i + 2, 9, 1, 4).setValues([[id, sig, updated, note]]);
}
function flag(sheet, i, note) {
sheet.getRange(i + 2, 12).setValue(note);
}
function installTrigger() {
ScriptApp.getProjectTriggers().forEach(function (t) {
if (t.getHandlerFunction() === 'syncToCalendar') ScriptApp.deleteTrigger(t);
}); // running it twice must not leave two triggers
ScriptApp.newTrigger('syncToCalendar').timeBased().everyHours(1).create();
}
```
Four rules prevent duplicates:
- **The ID lives in the row.** A new event’s `getId()` goes into column I at once and `flush` commits it. Sorting is safe if I–L are included.
- **Unchanged rows are skipped.** If columns A–H match the signature in J, the calendar is not touched.
- **A missing event is not recreated.** The script notes it in L; clearing cell I recreates it. A cancelled row whose event is already gone closes as cancelled; cancellation also deletes an event edited in the calendar.
- **A bad row does not stop the run; runs never overlap.** Errors go into the row’s note. A manual run during the hourly trigger waits 30 seconds on `LockService`, then exits.
One gap remains: a stop between creating an event and writing its ID yields a second event.
### Setup and trigger
Paste the script under **Extensions > Apps Script**, run `syncToCalendar` once to grant permissions, then `installTrigger`, which first deletes this account’s earlier trigger. Simple `onEdit` will not do: Google’s [triggers page](https://developers.google.com/apps-script/guides/triggers) says simple triggers cannot use services needing authorization or run over 30 seconds, and script or API changes fire no triggers. That formula recalculation does not either is my inference. Hourly, changes reach the calendar within about an hour.
### All-day or timed?
Blank F means all-day; a time means a timed event lasting G hours (2 if G is blank). “On site that day” visits fit all-day; visits where a machine stops at a set hour should be timed. `createAllDayEvent` uses only the day; for multi-day all-day events the end date is exclusive, so a three-day overhaul ends on day four. The [CalendarEvent reference](https://developers.google.com/apps-script/reference/calendar/calendar-event) says `setTime` turns an all-day event into a regular one and `setAllDayDate` does the reverse, so the script does not delete and recreate on a type change (that the ID stays the same is my inference).
### Time zones: three separate settings
Script, spreadsheet and calendar each have a time zone; if the first two differ, times can shift. `createEvent` reads times in the script’s zone when none is given. The script’s zone is in project settings (`timeZone` in the manifest, e.g. `Europe/London`), the spreadsheet’s under **File > Settings > Time zone**. Per Google’s [time zone page](https://support.google.com/calendar/answer/37064?hl=en), events are converted to UTC and each viewer sees local time. The calendar’s zone matters for all-day events, which start at midnight in that zone (CalendarEvent reference).
So the script stops if spreadsheet and script zones differ, and reads the time as displayed text (`getDisplayValues`): an HH:MM display such as “09:00” goes as 09:00; “9:00 AM” or “09.00” is flagged. The date comes from the cell value and holds while the zones match. For a one-country team, align all three.
### Quota: the script that forgets the ID
Google’s [Apps Script quotas page](https://developers.google.com/apps-script/guides/services/quotas) (as of 2026-10-31) allows 5,000 calendar events created per day, 10,000 on Workspace; 6 minutes per execution; total trigger runtime of 90 minutes a day on a personal account, 6 hours on Workspace. Hourly, that averages 3.75 minutes per run on a personal account. Quotas can change without notice.
The real risk is a script that never writes the ID back: hourly, it creates events for all 146 rows, 3,504 a day, 3,358 duplicates on day one, under the 5,000 limit, so the quota never stops it. Every 15 minutes, the personal quota would run out early in the 35th run, after 34 full runs (4,964 events).
## 4. Why is two-way sync hard?
Writing calendar changes back is hard because the calendar trigger does not say which event changed; per Google’s [trigger events page](https://developers.google.com/apps-script/guides/triggers/events) it gives only the calendar ID. Google recommends the Calendar advanced service: get a sync token with `Events.list()` and fetch only later changes on each trigger. `getId()` returns the iCalUID, not the API event ID (CalendarEvent reference); match on the iCalUID field.
The second difficulty is the conflict rule. Of the 5 events technicians moved, one row later changed in the sheet too; a script without a rule would overwrite the calendar change. The script keeps the last-updated time in K, so it skips that row with a note; to let the sheet win, clear K. The other 4 rows never changed, so they stayed different. Catching them needs a daily check comparing every event with the sheet.
My rule: the sheet owns the date. Give technicians view-only access; they report changes to the planner. If calendar-to-sheet sync is truly needed, every field needs one owner and a conflict rule; see the field ownership table on the [Google Sheets two-way sync](https://oguzerol.com/en/google-sheets-two-way-sync-app/) page.
## 5. Which calendar, and under whose account?
The script writes with the authority of whoever installed the trigger: per Google’s [installable triggers page](https://developers.google.com/apps-script/guides/triggers/installable), installable triggers run under their creator’s account and other accounts cannot see them. `getCalendarById` returns `null` without access or subscription, and the script stops.
- **The departing employee risk.** If the installer’s personal account is closed, sync stops, and colleagues who cannot see the trigger may notice late (my inference). Use a permanent planning account for calendar and trigger.
- **Calendar permissions.** Of the levels on Google’s [calendar sharing page](https://support.google.com/calendar/answer/37082?hl=en), I recommend “Make changes and see event details” for the script’s account and “See event details” for technicians. On work and school accounts, your administrator decides whether calendars can be shared.
- **A shared calendar instead of invitations.** CalendarApp can add guests; `sendInvites` is off by default. Sharing one calendar avoids invitation emails, at a cost: everyone sees every job and a new technician gets no notice. One calendar per technician shows each person only their own work, but the script must write to the right calendar and move events when technicians change.
## 6. Where does a web application start?
A sheet and a script carry a plan to the calendar without checking it. If any of these four gets a “yes”, consider moving planning into an application:
1. **Can one technician be booked at two sites at once?** A calendar shows overlaps; it does not prevent them. When BK-016 moves to Week 8 Tuesday 13:00, only a rule knows whether that technician is available.
2. **Who may change a date?** Sheets shares at file or protected-range level. A row-level rule such as “site leads reschedule only their own site’s visits, the planner approves” is enforced by hand.
3. **Must the customer be told?** Each of the 23 date changes affects a customer. A calendar event does not reach them; a reschedule notice and confirmation need their own record.
4. **Will someone ask why a visit slipped?** “Why after 15 weeks instead of 13” needs who changed it, when and why. Version history shows the cell change, not the reason.
If all four are “no”, Apps Script is enough; you do not need an application.
Scope that could be developed: screens for planner, site lead and technician; a check blocking double-booked technicians; a change history with reasons and approvals; customer notices; only the approved plan written to the calendar. AI can suggest the next service date from running hours and past postponements; the planner approves. For maintenance records see the [periodic maintenance tracking app](https://oguzerol.com/en/periodic-maintenance-tracking-app/); for technician and equipment availability, the [appointment and resource planning app](https://oguzerol.com/en/appointment-resource-planning-app/).
It can be built to fit your needs, with the scope defined in writing at the first step. We choose the notification channel together at that step. The virtual private server (VPS) can be opened in your company’s name; the data is yours and you can export it to Excel or CSV at any time. For small and mid-sized teams there are no per-user licences; the running cost is the server plus maintenance. The source code sits in a repository you can access, with run instructions, a dependency list and known limitations.
The first meeting is paid. For a written scope, send three things through the [contact page](https://oguzerol.com/en/contact/): your sheet’s column headers, how many dates change in a month, and who views the calendar.
## What I could not verify
Sources read on 2026-10-31; the script was not run in a real Google account.
- Whether `getEventById` returns `null` or a cancelled event after deletion; the cancel branch and the “not found” note rely on it.
- Whether `getLastUpdated()` reflects the script’s own write when read right after it. If not, the script could flag its own update as a calendar edit; watch for this on the first test.
- How long a 146-row run takes; I expect it to fit the 3.75-minute budget but have not measured it.
## Frequently Asked Questions
### Will technicians get a reminder on their phones?
The script can add one: per the CalendarEvent reference, `addPopupReminder(minutes)` adds a pop-up notification and `resetRemindersToDefault()` uses the calendar’s default reminders. Phone display depends on each technician’s Calendar app settings.
### Couldn’t I create periodic maintenance as one recurring event?
I would not. Per the CalendarApp reference, events in a series can share one ID and `getEventById` returns the series’ first event, so updating one postponed visit gets harder. One row and event per visit keeps postponements to one row.
### How do I switch to the script when the calendar already has manual events?
The first run creates events for empty-ID rows, so old events become duplicates. Either point the script at a new, empty calendar and stop sharing the old one, or write the old events’ IDs into column I once.
[Back to top ↑](https://oguzerol.com/en/google-sheets-calendar-sync-app/#icerik)
WHAT YOU CAN ASK FOR
## How do I work? Work-hour packages
Tell me about your business and what you need on WhatsApp or by phone; we agree on **a work block of somewhere between 5 and 40 hours** and I start doing what is needed. What you get is not a calendar window: it is net working hours spent directly on your business. I can use 40 hours working three days straight, or deliberately spread it out and finish it over a year: whatever the work calls for. I do not spend my time estimating how long something will take, I spend it doing the work; every hour I spend leaves a lasting result in your business. We keep going for as long as you find it useful.
WORK BLOCKS
## Why not monthly? Does a 40-hour block mean one week?
On a fixed monthly fee both sides are watching the wrong thing: you watch a fixed cost, the other side watches how many more contracts like this they can line up. Working by the hour puts us both in front of the same thing: the real value of the work that got done. I know not having an upfront answer to "how much will this cost in total?" is the natural cost of this model. But instead of paying a fixed fee for months to a setup that is not producing results, you only pay for the qualified time spent on your work: and you see exactly where that time went, start to finish. That is why my clients keep coming back.
- **5 hours**: **300 € + VAT** (60€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%205-hour%20work%20block.)
- **10 hours**: **500 € + VAT** (50€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2010-hour%20work%20block.)
- **20 hours**: **800 € + VAT** (40€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2020-hour%20work%20block.)
- **40 hours**: **1,400 € + VAT** (35€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2040-hour%20work%20block.)