I made a working bound script in a clone of my original Google Spreadsheet, put together over a course of several days.
I then copied my formula to a new spreadsheet.
Suddenly, even though I don't think I made any changes to any relevant code, I'm seeing "reference error: "Calendar" is not defined google API."
I have a lot of code so it would be difficult to paste it all, but the relevant section is here:
var start = (passed as argument to function);
var end = (passed as argument to function);
var calendarId = 'redacted'//source calendar
var optionalArgs = {
timeMin: start.toISOString(),
timeMax: end.toISOString(),
showDeleted: false,
singleEvents: true,
maxResults: null,
orderBy: 'startTime'
};
var response = Calendar.Events.list(calendarId, optionalArgs);
This took me way too long to get through, so dear person of the future, if I've saved you a few minutes, my struggles will be worthwhile.
Calendar API has to be turned on for Calendar.Events.list to work.
In your script's menu, select "Resources" then "Advanced Google Services." You will see a list of APIs with switches.
To use the API for another service, you must turn it on both here and in your Google Developers Console (just follow the link at the bottom of the dialogue window).
Also, I had sort of assumed that in the Google Developers Console, once an API was turned on, it was turned on for you as a user, but there is a unique console for each project, which is what you're taken to when you follow the link. You have to turn it on again for each additional project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With