Google sheet to calendar sync to send email invites to attendees

1,307 views
Skip to first unread message

gitika srivastava

unread,
May 19, 2021, 9:05:06 AM5/19/21
to google-apps-sc...@googlegroups.com
Hello,

I am new to this and was hoping someone could help me with a script to cater the following scenario.
I have a Google doc- excel where I am listing the title, start date time, end date time, guest 1 email ID, guest 2 email ID, guest 3 email ID, and guest 4 email ID.
Something like this:
titlestart timeend timeguest1guest2guest3guest4
WCC19-05-2021 20:30 19-05-2021 21:00ab...@gmail.comab...@gmail.comab...@gmail.com
Based on this information, I want to run a script to fetch information from this sheet and add calendar meeting to all these email ids. This is the script that I have been able to compile until now:

function scheduleShifts() {
  /** 1) Task-1 Open the event calendar. **/
  var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = "My email ID";
var eventCal = CalendarApp.getCalendarById(calendarId);
/** Task-2 Select data in spreadsheet. **/
var signups = spreadsheet.getDataRange().getValues();
/** Step-3 Create the events.  **/
for (x=0;x<signups.length;x++)
var shift = signups[x];
var title = shift[0];
var startdate = shift[1];
var enddate = shift[2];
var guest1 = shift[3];
var guest2 = shift[4];
var guest3 = shift[5];
var guest4 = shift68];
eventCal.createEvent(title,new Date(startdate), new Date(enddate),
{guest1,guest2,guest3,guest4,sendInvites:true})
}

It says execution is complete but nothing appears on the calendar. I feel it is wrong but there are so many pieces that I am reading that I am stuck at it for the last couple of days.

Could someone please help me with this use case. 
Also, what is the significance of calendar ID. If I want to send out the invite to only the people whose email I have mentioned and not tag it to a calendar which has the entire team in it, would my personal email id suffice?

Thanks a lot in advance,
I hope I can find a solution here.

Regards,
Gitika

Sandi Berg

unread,
May 19, 2021, 9:07:30 AM5/19/21
to google-apps-sc...@googlegroups.com
Calendar id is the calendar you want to add the event to. Ie)...the main calendar. It isn't the participants' but your calendar.

You will need to grab your calendar's id from settings.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAE43t4eMhZtLkyBOhdPzOMeic30KaU6MFjeWMvTOfdyM%2BbLjrg%40mail.gmail.com.

Sandi Berg

unread,
May 19, 2021, 9:08:40 AM5/19/21
to google-apps-sc...@googlegroups.com
Oops. I missed that you have that in there (assuming you removed your email address and wrote the generic statement for sharing.

Bennett, Scott

unread,
May 19, 2021, 9:10:53 AM5/19/21
to google-apps-sc...@googlegroups.com
I could be wrong, but I believe that your guest list will need to be an array.  

--

gitika srivastava

unread,
May 19, 2021, 9:15:08 AM5/19/21
to google-apps-sc...@googlegroups.com
Hey!
Thanks Sandi and Scott for responding so quickly. 
Yes, I realized that the calendar ID I was stating was where the meeting was being set up. However, the guests that I added weren't receiving the invites.
Could you please share an example of how my information should be organized and how I can call it from the script?

I am very naive in this area, as I said previously, And any inputs would be greatly appreciated.

Thank you!

Bennett, Scott

unread,
May 19, 2021, 9:20:44 AM5/19/21
to google-apps-sc...@googlegroups.com
eventCal.createEvent(title,new Date(startdate), new Date(enddate),
{guests:[guest1,guest2,guest3,guest4],sendInvites:true})

Bennett, Scott

unread,
May 19, 2021, 9:23:32 AM5/19/21
to google-apps-sc...@googlegroups.com
You may have to code in some things based on the number of guests if they will not always be the same length.  I am not sure what will happen if there is a null in the guest list.  

On Wed, May 19, 2021 at 8:15 AM gitika srivastava <gitik...@gmail.com> wrote:


--
Scott Bennett
Data and Assessment Coordinator/Math Teacher
Bradley-Bourbonnais Community High School

gitika srivastava

unread,
May 19, 2021, 9:29:52 AM5/19/21
to google-apps-sc...@googlegroups.com
Hi Scott,

There will always be 4 email ids populated in the 4 guest columns.The length of the email ids will vary based on the individual's name.
I tried using the syntax you shared and I am getting an error message:
image.png

Sandi Berg

unread,
May 19, 2021, 9:34:54 AM5/19/21
to google-apps-sc...@googlegroups.com
Not sure if you noticed but guest4 has a 6 instead of a [

--

gitika srivastava

unread,
May 19, 2021, 10:06:11 AM5/19/21
to google-apps-sc...@googlegroups.com

Sandi Berg

unread,
May 19, 2021, 10:19:20 AM5/19/21
to google-apps-sc...@googlegroups.com
Here's a bit of a brute force.  eventCal.createEvent(titlestartTimeendTime, {sendInvites:true}).addGuest(guest1).addGuest(guest2);

gitika srivastava

unread,
May 19, 2021, 11:19:16 AM5/19/21
to google-apps-sc...@googlegroups.com
This avoided the error, but it still doesn't schedule meetings yet. Can you help?

Bennett, Scott

unread,
May 19, 2021, 11:19:33 AM5/19/21
to google-apps-sc...@googlegroups.com
Is everything working now?

Sandi Berg

unread,
May 19, 2021, 11:21:01 AM5/19/21
to google-apps-sc...@googlegroups.com
One thing I did when creating my version to copy yours is set the format of the date cells to date with time. Did you do that?

Sandi Berg

unread,
May 19, 2021, 11:24:14 AM5/19/21
to google-apps-sc...@googlegroups.com
Here is the sheet I made to play with it:  https://docs.google.com/spreadsheets/d/1fUk3RryYlDN3nqsFMCw56Mz68eMc1s_TSv-XHR61C3Q/edit?usp=sharing

I will note that it doesn't send the invite to the users but it works. I have deleted my email address from the script so you would need to replace that.  I also only added the first two guest emails but just repeat the .addGuest

Bennett, Scott

unread,
May 19, 2021, 11:24:50 AM5/19/21
to google-apps-sc...@googlegroups.com
try logging your two dates to confirm they are what you are expecting.  I have done a few of these and they always give me problems.  

function scheduleShifts() {
  /** 1) Task-1 Open the event calendar. **/
  var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = "My email ID";
var eventCal = CalendarApp.getCalendarById(calendarId);
/** Task-2 Select data in spreadsheet. **/
var signups = spreadsheet.getDataRange().getValues();
/** Step-3 Create the events.  **/
for (x=0;x<signups.length;x++)
var shift = signups[x];
var title = shift[0];
var startdate = shift[1];

Logger.log(startdate)

var enddate = shift[2];

Logger.log(enddate)

var guest1 = shift[3];
var guest2 = shift[4];
var guest3 = shift[5];
var guest4 = shift[6];

eventCal.createEvent(title,new Date(startdate), new Date(enddate),
{guest1,guest2,guest3,guest4,sendInvites:true})
}

Sandi Berg

unread,
May 19, 2021, 11:27:22 AM5/19/21
to google-apps-sc...@googlegroups.com
I don't know if you saw the comment that I started to type in the ss when you were there but your date wasn't wrong. I just relooked. It was my typo. lol.

Bennett, Scott

unread,
May 19, 2021, 11:29:14 AM5/19/21
to google-apps-sc...@googlegroups.com
When you are retrieving your data from the sheet use getDisplayValues() instead of getValues()

Bennett, Scott

unread,
May 19, 2021, 11:32:19 AM5/19/21
to google-apps-sc...@googlegroups.com
I think I may have figured it out. 
Make your dates in the sheet have the format of 2021-05-19 08:00 then use getDisplayValues()

Kim Nilsson

unread,
May 19, 2021, 2:05:44 PM5/19/21
to Google Apps Script Community
Guys, I just can't get the list of users correct unless I type it out like this manually.
Is there no other way to create the list of guests with the correct comma-separated format surrounded by quotes?
Also, why isn't the new event id displayed in the logger row I added? It only prints the calendar id (my email address, and not the new event id).

function scheduleShifts() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var calendarID = "MyEmail/CalendarAddress";
  var eventCal = CalendarApp.getCalendarById(calendarID);
  var signups = spreadsheet.getRange("A2:G2").getDisplayValues();
  for (x = 0; x < signups.length; x++) {
    var shift = signups[x];
    var title = shift[0];
    var startTime = shift[1];
    var endTime = shift[2];
    var guest1 = shift[3];
    var guest2 = shift[4];
    var guest3 = shift[5];
    var guest4 = shift[6];

    // I could only get the guests to be added and invited if I formated the syntax like this

    eventCal.createEvent(title, new Date(startTime), new Date(endTime), { location: 'The Moon', sendInvites: true, guests: "'" + guest1 + "," + guest2 + "," + guest3 + "," + guest4 + "'" });

    Logger.log('Event ID: ' + eventCal.getEventId());// This doesn't display the id of the event! Why not?
  }
}

Sandi Berg

unread,
May 19, 2021, 2:11:01 PM5/19/21
to google-apps-sc...@googlegroups.com
The code from my sheet for the emails didn't work for you? That's weird. It worked for me. 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Sandi Berg

unread,
May 19, 2021, 2:11:45 PM5/19/21
to google-apps-sc...@googlegroups.com
Could you share a link to your file?

cbmserv...@gmail.com

unread,
May 19, 2021, 2:13:38 PM5/19/21
to google-apps-sc...@googlegroups.com

The list of guests does not need to be an array.

 

You can just have all the emails comma separated and included in one long string as the 1 guest in the invite.

 

All of the emails in the comma separated guest list will get an invite.

--

You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Bennett, Scott

unread,
May 19, 2021, 2:18:05 PM5/19/21
to google-apps-sc...@googlegroups.com
You are trying to get the eventID of  the calendar, not the event.
So they need to be strings, so you could just join them 
let guestArray = [guest1,guest2,guest3,guest4]
let guestString = guestArray.toString()

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Kim Nilsson

unread,
May 19, 2021, 2:20:41 PM5/19/21
to Google Apps Script Community
Yes, that's the problem, because how do you insert the guest1-4 values inside the {guests: ........} to be represented as a single string?

No, bsdemon, your script doesn't send the invite. It does add the users correctly to the event, but nobody gets an invite.

cbmserv...@gmail.com

unread,
May 19, 2021, 2:23:09 PM5/19/21
to google-apps-sc...@googlegroups.com

To get the id of the event, use:

 

eventCal.getId();

 

From: 'Bennett, Scott' via Google Apps Script Community <google-apps-sc...@googlegroups.com>
Sent: May 19, 2021 11:18 AM
To: google-apps-sc...@googlegroups.com
Subject: Re: [Apps-Script] Google sheet to calendar sync to send email invites to attendees

 

You are trying to get the eventID of  the calendar, not the event.

Kim Nilsson

unread,
May 19, 2021, 2:29:58 PM5/19/21
to Google Apps Script Community
That array-to-string did the trick!
I also figured out that I could grab the eventid in the same command.

function scheduleShifts() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var calendarID = "CalendarID/Email";
  var eventCal = CalendarApp.getCalendarById(calendarID);
  var signups = spreadsheet.getRange("A2:G2").getDisplayValues();
  for (x = 0x < signups.lengthx++) {
    var shift = signups[x];
    var title = shift[0];
    var startTime = shift[1];
    var endTime = shift[2];
    var guest1 = shift[3];
    var guest2 = shift[4];
    var guest3 = shift[5];
    var guest4 = shift[6];
    let guestArray = [guest1,guest2,guest3,guest4]
    let guestString = guestArray.toString()

    var eventID = eventCal.createEvent(titlenew Date(startTime), new Date(endTime), { sendInvitestrueguestsguestString}).getId();

    Logger.log('Event ID: ' + eventID);// Figured out how to get the event id. :-)
  }
}

Kim

Kim Nilsson

unread,
May 19, 2021, 2:48:30 PM5/19/21
to Google Apps Script Community
Next thing to make sure is correct. Timezone in the script.
May also have to set correct language and TZ in the Sheet (I did, anyway).

Make sure appscript.json is visible in the editor and adjust the timezone to where you are. Else the calendar events will be wildly off. :-)
Worked fine after I changed mine to Europe/Stockholm.

The script works when adding more rows, as long as the range (value of G) is increased.

Should work fine to add more columns of details to be included, like location that I inserted manually a few times. Description, for example, if you wish to add some text to it.

Kim

gitika srivastava

unread,
May 20, 2021, 10:57:15 AM5/20/21
to google-apps-sc...@googlegroups.com
So, I used the code with the array-to -string and this is how it looks now:
function scheduleShifts() {
  /** 1) Task-1 Open the event calendar. **/
  var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = "ab...@gmail.com";
var eventCal = CalendarApp.getCalendarById(calendarId);
/** Task-2 Select data in spreadsheet. **/
var signups = spreadsheet.getRange("A2:G2").getDisplayValues();
/** Step-3 Create the events.  **/
for (x=0;x<signups.length;x++)
var shift = signups[x];
var title = shift[0];
var startdate = shift[1];
Logger.log(startdate)
var enddate = shift[2];
Logger.log(enddate)
var guest1 = shift[3];
Logger.log(guest1)
var guest2 = shift[4];
Logger.log(guest2)
var guest3 = shift[5];
Logger.log(guest3)
var guest4 = shift[6];
Logger.log(guest4)
/**eventCal.createEvent(title,new Date(startdate), new Date(enddate),
,sendInvites:true}) **/
let guestArray = [guest1,guest2,guest3,guest4]
let guestString = guestArray.toString()

var eventID = eventCal.createEvent(titlenew Date(startdate), new Date(enddate), { sendInvitestrueguestsguestString}).getId();
Logger.log('Event ID: ' + eventID);
  }

The data is as follows:
titlestart timeend timeguest1guest2guest3guest4
WCC2021-05-22 09:00AM2021-05-22 09:30AMab...@gmail.com ab...@gmail.com ab...@gmail.com
The timezone is:
{
  "timeZone""America/Toronto",
  "dependencies": {
  },
  "exceptionLogging""STACKDRIVER",
  "runtimeVersion""V8"
}
It executed successfully, but I still don't see anything on my calendar or the guests calendar. I am not sure what isn't working for me.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Bennett, Scott

unread,
May 20, 2021, 11:03:15 AM5/20/21
to google-apps-sc...@googlegroups.com
I used this type of code a lot over the past year.  I will tell you that if the date is off slightly it causes a huge issue.  This may sound odd but I kept having events created around 1969-1970 because the dates were off slightly.  You may want to check and see if events are being created in the timeframe.  


gitika srivastava

unread,
May 20, 2021, 11:09:43 AM5/20/21
to google-apps-sc...@googlegroups.com
Yeah, That is bang on. It got created for 1st JAN 1970. What time format worked for you?

Bennett, Scott

unread,
May 20, 2021, 11:23:01 AM5/20/21
to google-apps-sc...@googlegroups.com
I would grab the date and time separately.  So I had a cell for date and a cell for time.  
var dayof = sheet.getRange('B1').getDisplayValue();// date event starts
    var starttime = sheet.getRange(activeRow,1).setNumberFormat('hh:mm:ss').getDisplayValue();// time that event starts
    var startdate = new Date(dayof+'T'+starttime);//actual value plugged into the calendar event creation
    var enddate = new Date(startdate.getTime()+(1000*60*meetinglength))//enddate and time of event

Bennett, Scott

unread,
May 20, 2021, 11:34:06 AM5/20/21
to google-apps-sc...@googlegroups.com
Maybe try getting rid of the AM PM in your time.  It needs to be 24 hr.

Bennett, Scott

unread,
May 20, 2021, 11:50:38 AM5/20/21
to google-apps-sc...@googlegroups.com
I just tested it, getting rid of the AM/PM should do the trick.

gitika srivastava

unread,
May 20, 2021, 11:54:09 AM5/20/21
to google-apps-sc...@googlegroups.com
Hi guys,

Thanks a lot for all your help. I really appreciate all your efforts. 
The code worked and is triggering the invites now. 
In case I need to add more complexity to this, will reach out to you for your guidance.
Again, thanks a lot!
Have a great day :) 

gitika srivastava

unread,
May 20, 2021, 12:18:03 PM5/20/21
to google-apps-sc...@googlegroups.com
And I am back. Too soon! haha

Just wanted to check with you on one more thing. So, I am going to use this code to schedule multiple meetings for different set of people. 
So, my sheet would look something like this:
titlestart timeend timeguest1guest2guest3guest4
WCC2021-05-23 21:002021-05-23 21:30email1email2email3email4
WCC2021-05-24 21:002021-05-24 21:30email5email6email7email8
WCC2021-05-25 21:002021-05-25 21:30email9email10email11email12
WCC2021-05-26 21:002021-05-26 21:30email13email14email15email16
WCC2021-05-27 21:002021-05-27 21:30email17email18email19email20
WCC2021-05-28 21:002021-05-28 21:30email21email22email23email24
WCC2021-05-29 21:002021-05-29 21:30email25email26email27email28
WCC2021-05-30 21:002021-05-30 21:30email29email30email31email32
WCC2021-05-31 21:002021-05-31 21:30email33email34email35email36
WCC2021-06-01 21:002021-06-01 21:30email37email38email39email40
WCC2021-06-02 21:002021-06-02 21:30email41email42email43email44
WCC2021-06-03 21:002021-06-03 21:30email45email46email47email48
WCC2021-06-04 21:002021-06-04 21:30email49email50email51email52
WCC2021-06-05 21:002021-06-05 21:30email53email54email55email56
WCC2021-06-06 21:002021-06-06 21:30email57email58email59email60
WCC2021-06-07 21:002021-06-07 21:30email61email62email63email64
WCC2021-06-08 21:002021-06-08 21:30email65email66email67email68
WCC2021-06-09 21:002021-06-09 21:30email69email70email71email72
WCC2021-06-10 21:002021-06-10 21:30email73email74email75email76
WCC2021-06-11 21:002021-06-11 21:30email77email78email79email80
WCC2021-06-12 21:002021-06-12 21:30email81email82email83email84
WCC2021-06-13 21:002021-06-13 21:30email85email86email87email88

In this scenario, is there a way to avoid duplicate triggers everytime I run the code, as I think we will be keeping the data as is and not deleting it.
So, I want to ensure that if events have been set up for lines 1 to 6 in the first run; they should somehow be flagged, so that next time when I have data populated from line 7 onwards, and I run the code, it only creates new events.

Thanks in advance!

Bennett, Scott

unread,
May 20, 2021, 12:24:52 PM5/20/21
to google-apps-sc...@googlegroups.com
You could add a checkbox or something to the last column and have it check that it is false before creating the event and set the value to true after each event is created.

Kim Nilsson

unread,
May 20, 2021, 12:41:09 PM5/20/21
to Google Apps Script Community
Yes, a "set" value or whatever you want in the column after guest4, that is set within the loop after creating the event.
And then have an if-else clause before creating the event.

Kim

gitika srivastava

unread,
May 26, 2021, 10:56:42 AM5/26/21
to google-apps-sc...@googlegroups.com
Hello,

I have been trying to find a method that I can use to post the calendar ID into the eventID column(added new column after guest4).
Have also declared var eventID=shift[7];

This is what I have added
function scheduleShifts() {
  /** 1) Task-1 Open the event calendar. **/
  var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = "gsriv...@salesforce.com";
var eventCal = CalendarApp.getCalendarById(calendarId);
/** Task-2 Select data in spreadsheet. **/
var signups = spreadsheet.getRange("A2:G2").getDisplayValues();
/** Step-3 Create the events.  **/
for (x=0;x<signups.length;x++)
var shift = signups[x];
var title = shift[0];
var startdate = shift[1];
Logger.log(startdate)
var enddate = shift[2];
Logger.log(enddate)
var guest1 = shift[3];
Logger.log(guest1)
var guest2 = shift[4];
Logger.log(guest2)
var guest3 = shift[5];
Logger.log(guest3)
var guest4 = shift[6];
Logger.log(guest4)
var eventID=shift[7];

let guestArray = [guest1,guest2,guest3,guest4]
let guestString = guestArray.toString()

var eventInstance = eventCal.createEvent(titlenew Date(startdate), new Date(enddate), { sendInvitestrueguestsguestString}).getId();
Logger.log('Event ID: ' + eventInstance);
eventIDsetValues(eventInstance);
  }

This creates an event but doesn't update the google sheet.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Bennett, Scott

unread,
May 26, 2021, 11:04:56 AM5/26/21
to google-apps-sc...@googlegroups.com
You will need to set the values using
spreadsheet.getRange(x,8).setValue(eventInstance)
You may have to use  spreadsheet.getRange(x+1,8).setValue(eventInstance) or something like that to get the rows to line up correctly.

You also need to declare your iterator variable
for(let x=0;x<signups.length;x++){
//
}

gitika srivastava

unread,
Jun 7, 2021, 3:47:41 AM6/7/21
to google-apps-sc...@googlegroups.com
Hello,

My code was working fine until I took it to the original spreadsheet. Now it is pointing to the wrong tab. And not yielding the right output. 
Can someone suggest how to ensure to point to the right tab when calling the active spreadhseet.

As of now, I am using
var ss = SpreadsheetApp.getActiveSheet();

Kim Nilsson

unread,
Jun 7, 2021, 3:53:41 AM6/7/21
to Google Apps Script Community
Use code that grabs the sheet by name instead.

 var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Name of your sheet');

Kim

gitika srivastava

unread,
Jun 9, 2021, 11:38:05 AM6/9/21
to google-apps-sc...@googlegroups.com
This worked. Thanks!
I have another question.
So, the code sends out calendar meetings to all the guests but it doesn't permit them to modify the event. I wanted to give them the option to reschedule.
Is that possible? If yes, could someone point me in the right direction?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Phil Bainbridge

unread,
Jun 10, 2021, 6:48:09 AM6/10/21
to Google Apps Script Community
Hi

Just to let you know I have a blog post here for creating Google Calendar events via the Calendar API. It is a downloadable Apps Script file if you want to take a copy but I found it really useful to breakdown/learn what is necessary for creating an event and doing things like setting dates/times and allowing Guests to modify, etc.

My finished solution can be found here - Bulk create Google Calendar events with optional Google Meet - again available for download, lots of comments in the code to help people understand what is going on.

Kind regards
Phil

gitika srivastava

unread,
Jun 10, 2021, 10:26:01 AM6/10/21
to google-apps-sc...@googlegroups.com
So, this is how my code looks like:
function wccschedule(){
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Apps Script");
  var index=2;
  var lastRow = spreadsheet.getLastRow();
  Logger.log(lastRow)
  var calendarID = "x...@gmail.com";
var eventCalendar = CalendarApp.getCalendarById(calendarID);
for(;index<=lastRowindex++)
{
  var title = spreadsheet.getRange(index,1,1,1).getValue();
  var description = spreadsheet.getRange(index,2,1,1).getValue();
  var startdate = spreadsheet.getRange(index,3,1,1).getValue(); 
  Logger.log(startdate)
  var enddate = spreadsheet.getRange(index,4,1,1).getValue();
  Logger.log(enddate)
  var guest1 = spreadsheet.getRange(index,5,1,1).getValue();
  Logger.log(guest1)
  var guest2 = spreadsheet.getRange(index,6,1,1).getValue();
  Logger.log(guest2)
  var guest3 = spreadsheet.getRange(index,7,1,1).getValue();
  Logger.log(guest3)
  var guest4 = spreadsheet.getRange(index,8,1,1).getValue();
  Logger.log(guest4)
  var Statusspreadsheet.getRange(index9,1,1).getValue();
  var guestsCanModify=true;
let guestArray = [guest1,guest2,guest3,guest4]
let guestString = guestArray.toString()
if(Status !="Done")
{
  var events = eventCalendar.createEvent(titlenew Date(startdate), new Date(enddate), {descriptionsendInvitestrueguestsguestStringguestsCanModify}).getId();
    Status = spreadsheet.getRange(index,9).setValue("Done");
}
}
}
It still executes successfully and creates a corresponding calendar event as well, but it still doesn't allow guests to modify events. What am I doing incorrectly.

I have also setup the authorization in the json file.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.

Phillip Bainbridge

unread,
Jun 10, 2021, 10:30:18 AM6/10/21
to Google Apps Script Community
Hi Gitika

Here's the response I put on my blog post after your comment:

The tool I've created uses the Calendar API where there are many more options available to define.

From your code it looks like you are using the 'Calendar App' which does not allow for details such as Guest modification to my knowledge.

Kind regards
Phil
Reply all
Reply to author
Forward
0 new messages