How to Insert Event in Google Calendar

Gosh I fixed it, I must have not deployed it and updated the URL. When I get back I’ll post my comprehensive steps and notes for anyone else attempting this.

But it does work now in the app. Strangely enough it adds it to my calendar today using the app, but tomorrow using the URL.

Thank you for all your help @muneer

1 Like

Be more specific in the description like Progress meeting March 25 9:30AM

1 Like

:+1:t2:
It’s working but getting the error
“The script completed but the returned value is not a supported return type”

1 Like

You can remove the return keyword and redeploy.

As long as you know what is the source of the issue it is OK to cast it.

The doPost and doGet expects HTMLService ot ContentService return type but we are not concerned about either of them in this context.

1 Like

I meant to ask, is it just as simple to edit any of these calendar events, or remove one altogether, or do I call a different script?

1 Like

You can have a look at the calendar class. It has all methods.

You can also use ContentService to return the event created as JSON.

1 Like

I’m not seeing delete event in this link, but a quick google search shows other appear to just use deleteEvent so I’m assuming it’s a separate script I need to create and call, for example if a user deletes an appointment of course the calendar event should be deleted as well.

I’ll work on editing events in the future where the calendar event gets updated as well as the Firebase data.

Do these calendar events have some kind of tag or unique identifier to refer to them easily in the future?

1 Like

When you click on any event you will see the details of how to call the event and what data will be returned once executed.

Just see the next page which has your answer

1 Like

I’m positive what I need is in here, but I don’t know how it correlates to assembling the blocks.

Like the method and return type, I don’t know what to do with those as far as the blocks go. Am I creating objects with setting query parameters?
Or am I creating new scripts?

I just don’t know what to do with this information

1 Like

I’m not sure if you’re asking me but you need to be specific of what you want so other members can guide you to where you look.

1 Like

I want to be able to edit and delete events. You said what I need is in those links, I don’t know what to do with the information in those links

1 Like

You have deleteEvent and you have a number of set..... methods which you can use to edit different parts of the event.

How could I edit this portion of a calendar event according to my blocks?

1 Like

Use the setDescription() to change it

1 Like

By this do I have to create another script?
Or do I just create a new object under the QueryParameters?

1 Like

Depends on how you created your GAS (Google Apps Scripts) in the first place.

2 Likes

I’m not sure of more than one method. I used the following, I don’t know if you need more information than this

   return CalendarApp.getDefaultCalendar().createEventFromDescription(event.parameter.eventDesc);
 }
1 Like

The createEventFromDescription() function returns an event ID which you need to save under the user created it for easier retrieval at a later stage.

You may also use getEventSeries() to get all events between two dates.

Once you have the event ID then you can use the setDescription() to amend the description related to that event.

Example

var myCal = CalendarApp.getDefaultCalendar();
var myEvent = myCal.createEventFromDescription("First description for the event");
// You have an even ID so you can proceed to change whatever you want in that event.
myEvent.setDecription("New description for the event");
myEvent.addGuest("info@tunkable.com");

Hope this helps

2 Likes

And I just add this to my existing script?

How would I add to the description upon first creating the event, as opposed to doing it later?

1 Like

I was just giving an example.

This would practically be in another script where you will need to pass the event ID obtained from the script used to create the event.

You will not need to create the calendar event again. I merely put it in the example so that readers know where to get the event ID from.

1 Like