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.
Here is the shared example sheet
Thank you in advance
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