moodLearning Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
google-form-to-calendar-sync [2018/01/26 01:23]
ktiamzon
google-form-to-calendar-sync [2018/01/26 02:24]
ktiamzon [Google Form-to-Calendar Sync]
Line 4: Line 4:
  
 Create a form with these questions: Create a form with these questions:
 +  * Event Title
 +  *  Event Start Date and Time
 +  *  Event End Date and Time
 +  *  Event Location
 +  *  Event Description
 +  *  Add Guest
  
-Event Title 
- 
-Event Start Date and Time 
- 
-Event End Date and Time 
- 
-Event Location 
- 
-Event Description 
- 
-Add Guest 
  
 Once done, go to Responses then click "View responses in sheets" Once done, go to Responses then click "View responses in sheets"
Line 32: Line 27:
 ====== Headline ====== ====== Headline ======
    var moment = Moment.load();    var moment = Moment.load();
- 
    var GLOBAL = {    var GLOBAL = {
   //the id of the form we will use to create calendar events    //the id of the form we will use to create calendar events 
   formId : "14WoTH-2Uq3tpqPpd2Z19S7OQjOyurri7GaVPsKZRg3w",     formId : "14WoTH-2Uq3tpqPpd2Z19S7OQjOyurri7GaVPsKZRg3w",  
-   
   //the id of the calendar we will create events on   //the id of the calendar we will create events on
   calendarId : "[email protected]",   calendarId : "[email protected]",
-   
   //a mapping of form item titles to sections of the calendar event   //a mapping of form item titles to sections of the calendar event
   formMap : {   formMap : {
Line 51: Line 43:
    },    },
    }    }
- 
   function onFormSubmit() {   function onFormSubmit() {
   var eventObject = getFormResponse();   var eventObject = getFormResponse();
   var event = createCalendarEvent(eventObject);   var event = createCalendarEvent(eventObject);
   }   }
- 
   function getFormResponse() {   function getFormResponse() {
   // Get a form object by opening the form using the   // Get a form object by opening the form using the
Line 112: Line 102:
   return eventObject;   return eventObject;
   }   }
- 
    function createCalendarEvent(eventObject) {    function createCalendarEvent(eventObject) {
   //Get a calendar object by opening the calendar using the   //Get a calendar object by opening the calendar using the
Line 134: Line 123:
     //end time, and description and guests stored in an      //end time, and description and guests stored in an 
     //options argument     //options argument
-    var event = calendar.createEvent(title, startTime,  +    var event = calendar.createEvent(title, startTime, endTime, options)
-                                     endTime, options)+
     } catch (e) {     } catch (e) {
       //delete the guest property from the options variable,        //delete the guest property from the options variable, 
Line 142: Line 130:
       delete options.guests       delete options.guests
       //create the event without including the guest       //create the event without including the guest
-      var event = calendar.createEvent(title, startTime,  +      var event = calendar.createEvent(title, startTime, endTime, options)
-                                       endTime, options)+
       }       }
     return event;        return event;