function twoMissions(){
// get Calendar ID
let sheet = SpreadsheetApp.getActiveSheet()
let id = SpreadsheetApp.getActive().getRangeByName("calendarID").getValue()
// get Event data...the filter allows us to only get rows that contain data, and to exclude the checkbox in the filter
let events = SpreadsheetApp.getActive().getRangeByName("EventList").getValues().filter(array => array.slice(0, -1).some(value => value !== ''));
//single day event with just title and date
events.forEach( function(e, index){
if(!e[8]){
let event = CalendarApp.getCalendarById(id)
.createAllDayEvent(
e[0],
e[1],
e[10],
{description: e[3],
location:e[4],
})
let newIndex = index+8;
sheet.getRange("J"+ newIndex).setValue(true);
// Send email notification
}
})
}
function sendNotificationEmail(event, recipient) {
let subject = 'New Event Added to Program Cycle and Mission Events Calendar';
body += 'Title: ' + event.getTitle() + '\n';
body += 'Date: ' + event.getAllDayStartDate().toDateString() + '\n'; // Get start date of all-day event
body += 'Description: ' + event.getDescription() + '\n';
body += 'Location: ' + event.getLocation() + '\n';
body += 'Guests: ' + event.getGuestList().join(', ') + '\n'; // Get list of guests
MailApp.sendEmail(recipient, subject, body);
}