heorling
heorling

Reputation: 379

Google Apps script event EventGuest does not have .getEmail()

Grabbing google calander events into drive sheets worked like a charm with some copy paste code...

But my attempts at extracting event guests from Google calendar into a spreadsheet met with little success. See screenshot. Here's the code.

function getEmailsFromArray(guestsArray){
var guestEmails = []
for (var i=1;i<guestsArray.length;i++) {
  guestEmails.push(i.getEmail()) // i does not have getEmail()
}
return guestsArray; }

And this is called as a lamda(?) when preparing the data inserted into

 getEmailsFromArray(events[i].getGuestList())

Here's the doc for getGuestList()

Is EventGuest not an object with functions but a string? Am I perhaps not stepping through the array properly? Should I cry uncle?

debugging calander events

Upvotes: 1

Views: 531

Answers (1)

WhiteHat
WhiteHat

Reputation: 61265

you have a few syntax issues, try this...

function getEmailsFromArray(guestsArray){
var guestEmails = [];
for (var i=0;i<guestsArray.length;i++) {
  guestEmails.push(guestsArray[i].getEmail());
}
return guestEmails; }

Upvotes: 1

Related Questions