Find duplicates within a calendar VBA

Status
Not open for further replies.

pantakos

Board Regular
Joined
Oct 10, 2012
Messages
161
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Please note: This is not VBA. This is a Google Sheets file using Google Apps Script.
 
Upvote 0
You are correct , please admin delete this one. I have created a new one.
Thank you
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,958
Messages
6,175,642
Members
452,663
Latest member
MEMEH

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