# How to Insert Event in Google Calendar

**URL:** <https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722>\
**Category:** Web API's\
**Created:** [December 4, 2020, 7:29am UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722 "2020-12-04T07:29:34Z")\
**Posts on this page:** 12\
**Page:** 4

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [July 3, 2022, 1:43am UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/64 "2022-07-03T01:43:04Z")

</div>

So what would the full script be to be able to set the title of the event like I currently have plus set the description?

I really do apologize for being so uninformed on these things.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [July 7, 2022, 9:21pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/65 "2022-07-07T21:21:44Z")

</div>

I tried adding the example you gave to my script but I’m not getting any positive results so far.  
I see where to get the event ID from but I’m not getting how to initially set the description in the first place.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 8, 2022, 8:26am UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/66 "2022-07-08T08:26:34Z")

</div>

> [@overshield](#):
>
> how to initially set the description in the first place.

I’ll try to put an example to show the process and how it works.

---

<div class="post-metadata">

**Author:** ![itsbacl4](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@itsbacl4](https://community.thunkable.com/u/itsbacl4)\
**Post date:** [July 23, 2022, 6:28pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/67 "2022-07-23T18:28:22Z")

</div>

To insert an event into G Calendar, you should go into the Personalization section.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 23, 2022, 7:57pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/68 "2022-07-23T19:57:56Z")

</div>

@overshield

It took me sometime to get free to do this.

For simplicity, I will use a Google sheet directly,  
This is what is in the Google sheet. The Event ID will be automatically filled by the script.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/9/6904465820e4b731db9399438f3919314993ac94.png)

This is the script that reads the information from the sheet and create the calendar event.

```auto
function AddEventToCalendar() {
    const sh = SpreadsheetApp.getActive();
  const cal = CalendarApp.getDefaultCalendar(); // or any other wat to access a calendar
  const ss = sh.getActiveSheet();

  let dateStart = new Date(ss.getRange(2,2).getValue());
  let dateEnd = new Date(ss.getRange(3,2).getValue());
  let desc = ss.getRange(4,2).getValue();

  
  let calEvent = cal.createEvent(desc, dateStart, dateEnd);
 
  ss.getRange(1,2).setValue(calEvent.getId());
}

```

This is the event after executing the script.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/0/a026588a38da48076541866ce091c919fc1c1e6f.png)

Now in the next script, I add a description to the meeting.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/c/9c8f6ce3d7172d54ade02d54be8e1964d4367e41.png)

This is done using this script

```auto
function ChangeEventDescription() {
  const sh = SpreadsheetApp.getActive();
  const cal = CalendarApp.getDefaultCalendar();
  const ss = sh.getActiveSheet();
  
  let eventID = ss.getRange(1,2).getValue();
  
  let calEvent = cal.getEventById(eventID);

  let newDesc = ss.getRange(9,2).getValue();
  

  calEvent.setDescription(newDesc);
}

```

The event ID is taken from the last script which was saved in the Google sheet  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/a/9a9cc8f77776db173a8e7c60575aa264c656e4bc.png)

Hope this makes it clear.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [July 23, 2022, 8:34pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/69 "2022-07-23T20:34:00Z")

</div>

Ok thanks, I personally won’t be using Sheets for my project for scheduling users.

So I would use an object to do this right?  
And would that cause the script to be any different?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 23, 2022, 8:50pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/70 "2022-07-23T20:50:25Z")

</div>

If you’re not using a sheet then I guess you would call a `web API` URL. In this case you need a separate URL for creating the event and another one for updating the description.

You also need to save the event ID somewhere you can retrieve later to effect the changes or to delete the whole event.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [July 23, 2022, 9:02pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/71 "2022-07-23T21:02:53Z")

</div>

The url wouldn’t charge each time right?

Just kinda the same way I’m doing it now I think

The event ID I can store easily in the cloud object

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [July 23, 2022, 9:52pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/72 "2022-07-23T21:52:38Z")

</div>

> [@overshield](#):
>
> the same way I’m doing it now

Yes the same with the added functionality to save the event ID to your cloud storage or return it to Thunkable.

You will then need another script for the change and deeply the script to get the URL for the event change.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [July 23, 2022, 10:06pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/73 "2022-07-23T22:06:30Z")

</div>

So what would the script be since I’m not using Sheets?

---

<div class="post-metadata">

**Author:** ![varshnysdbfcj7](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@varshnysdbfcj7](https://community.thunkable.com/u/varshnysdbfcj7)\
**Post date:** [February 14, 2023, 3:21am UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/74 "2023-02-14T03:21:16Z")

</div>

So I am trying to use the app you built but it is not working. When it says copy and paste it, it won’t let me paste it.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:19pm UTC](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722/75 "2024-11-08T12:19:55Z")

</div>

Closed on November 8, 2024, 12:19pm UTC



[Previous page](https://community.thunkable.com/t/how-to-insert-event-in-google-calendar/1019722.md?page=3)
