Find duplicates within a calendar Google Apps Script

pantakos

Board Regular
Joined
Oct 10, 2012
Messages
158
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello all,

I have the below code and I want if it possible to check if the event at the calendar already exists. If yes then dont make a duplicate event. If not create it.

VBA Code:
// Δημιουργία Μενού

function onOpen(){
const ss = SpreadsheetApp.getActive();
const menuEntries = [];
menuEntries.push({name: 'Εισαγωγή σε Ημερολόγιο', functionName: 'scheduleShifts'});
ss.addMenu('Carousel', menuEntries);
}

//

function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarID = spreadsheet.getRange("B2").getValue();
var eventCal = CalendarApp.getCalendarById(calendarID);
const signups = spreadsheet.getRange("A4:D110")
.getValues()
.filter(row => row.every(String));

for (x=0; x<signups.length;x++)

{
var shift = signups[x];
var startTime = shift[0];
var action= shift[2];
var description= shift[1];
var endTime= shift[3];
eventCal.createEvent(action, startTime, endTime, { description: shift[1] } ).setColor(4)
}
}

Here is the shared example sheet

Thank you in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,216,110
Messages
6,128,892
Members
449,477
Latest member
panjongshing

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top