Hi I've been trying to experiment with google's script editor and i think that I've gotten the code right but it wont seem to work. I used the code they made in google's tutorial video with edits but it cant seem to create an event. On the executions page it says completed but no new event is showing up.
Anyway i've attached screen shots of the sheet as well as the code. Hope y'all can help thanks!
function scheduleMeetings() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange('H6').getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var tasks = spreadsheet.getRange("G10:H100").getValue();
for (x=0; x<tasks.length; x++) {
var schedules = tasks[x];
var date = schedules[0];
var task = schedules[1];
eventCal.createAllDayEvent(task, date);
}
}
Try this:
function scheduleMeetings() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange('H6').getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var tasks = spreadsheet.getRange("G10:H100").getValues();//you had getValue()
for (var x=0;x<tasks.length;x++) {
var schedules = tasks[x];//Select a row
var date = schedules[0];//column G
var task = schedules[1];//column H
//you may need to add var date=new Date(schedules[0]);
eventCal.createAllDayEvent(task, date);
}
}