I hitting an error when I try to add multiple attendees via my spreadsheet. It works with one but when I try comma-separate to include multiple attendees it throws an error:
Error GoogleJsonResponseException: API call to calendar.events.insert failed with error: Invalid attendee email. createNewEventWithMeet @ Code.gs:34
function createNewEventWithMeet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Calendar_Events");
var last_row = sheet.getLastRow();
var data = sheet.getRange("A2:E" + last_row).getValues();
var cal = CalendarApp.getCalendarById("[email protected]");
for(var i = 0;i< data.length;i++){
var event_name = data[i][0];
var start_time = data[i][1];
var end_time = data[i][2];
var event_description = data[i][3];
var attendees_event = data[i][4];
//.setVisibility(CalendarApp.Visibility.PRIVATE);
const mst = "-06:00";
const calendarId = "[email protected]";
const resource = {
start: { dateTime: start_time+mst },
end: { dateTime: end_time+mst },
attendees: [{ email: attendees_event }],
conferenceData: {
createRequest: {
requestId: "[email protected]",
conferenceSolutionKey: { type: "hangoutsMeet" },
},
},
summary: event_name,
description: event_description,
};
const res = Calendar.Events.insert(resource, calendarId, {
conferenceDataVersion: 1,
});
var googleMeet_Link = res.hangoutLink;
console.log(res);
}
}
I've tried to create multiple columns to split it out but I cannot seem to make it work.