user13708028
user13708028

Reputation: 329

Google script create event - issues with event description

This is probably a Type issue, but I just can't seem to solve it.

The code, running from Sheets, based on this:

var eventdescription = 'test';
    
var event = CalendarApp.getCalendarById(calendarid).createEvent(
    eventtitle,
    startfull,
    endfull,
    {description: eventdescription},
    {location: eventaddress.toString()}
);

The error:

Cannot find method createEvent(string,object,object,object,object).

I had a similar issue with the location but this was solved by adding toString(). With the description, I cannot seem to find a solution. Isn't it a string as well? It doesn't work with or without the toString().

Omitting the {description: eventdescription}, allows the script to run with no issues, but of course with no description in the event.

Any ideas how to make it work? Thanks!

Upvotes: 1

Views: 871

Answers (1)

ziganotschka
ziganotschka

Reputation: 26826

The advanced options need to go all within the same curly brackets:

var eventdescription = 'test';
    
var event = CalendarApp.getCalendarById(calendarid).createEvent(
    eventtitle,
    startfull,
    endfull,
    {description: eventdescription, location: eventaddress.toString()}
);

Upvotes: 2

Related Questions