I’m trying to create a event in my google calendar from a cell on a spreadsheet. This is what I have so far, but is not working. Any ideas?
function createCalendarEvent() {
let XCalendar = CalendarApp.getCalendarById("calendaiID");
let sheet = SpreadsheetApp.getActiveSheet();
let task = sheet.getDataRange().getValues();
task.splice(0.1);
task.forEach(function(entry){
XCalendar.createAllDayEvent(entry[0],entry[1])
})
}
This is how the sheet looks.
Try this:
function createCalendarEvent() {
let cal = CalendarApp.getCalendarById("calendaiID");
let sheet = SpreadsheetApp.getSheetByName("Sheet Name");
let vs = sheet.getDataRange().getValues();
vs.forEach(r => {
cal.createAllDayEvent(r[0], new Date(r[1]))
});
}