I would like to automatically run a function to create a new event in google script when a new row is added to google sheet without adding multiple events. I just want the the new event to be created. My script works but it adds ALL the rows from my sheet again instead of just the newest one added.
function createCalendarEvent() {
let communityCalendar = CalendarApp.getCalendarById("dlv2d6fo8n552173u2ifl7qn9g@group.calendar.google.com")
let sheet = SpreadsheetApp.getActiveSheet();
let scheduleEvent = sheet.getDataRange().getValues();
scheduleEvent.splice(0 ,1);
scheduleEvent.forEach(function(entry){
communityCalendar.createEvent(entry[1], entry[2], entry[3])
});
}
I set a trigger to run the function, but like I said it runs the function for the whole sheet not just the newest row (or event) added