`createEvent(title, startTime, endTime, options) `
2. 參量
  
      | 名稱 | 類型 | 描述 | 
  | `title ` | `String ` | 活動的標題 | 
  | `startTime ` | `Date ` | 活動開始的日期和時間 | 
  | `endTime ` | `Date ` | 事件結束的日期和時間 | 
  | `options ` | `Object ` | 指定高級參數的JavaScript對象,如下所示 | 
  
3. 進階參數
  
      | 名稱 | 類型 | 描述 | 
  | `description ` | `String ` | 事件的描述 | 
  | `location ` | `String ` | 活動地點 | 
  | `guests ` | `String ` | 以逗號分隔的電子郵件地址列表,應將其添加為來賓 | 
  | `sendInvites ` | `Boolean ` | 是否發送邀請電子郵件(默認: `false `) | 
  
 
### 四、程式碼
 ```
//Line權杖
var token = "Line權杖"; 
function getFormData(e) {
  var ss = SpreadsheetApp.getActive();
  var ws = ss.getActiveSheet();
  var title = ws.getRange(1, 1, 1, ws.getLastColumn()).getValues()[0];//取得表單中文欄名
  var message = "\n\n";
  var data = {};
  for(i in title){
    message += title[i] + ":" + e.values[i] + "\n\n";
    data[title[i]] = e.values[i];
  }
  //通知Line
  sendLineNotify(message);  
   
  //通知日曆 
  //時間戳記	標題	主辦人	日期	開始時間	結束時間	地點	備註
   
  var title = data['標題'] + "-" + data['主辦人']; //日曆標題
  var startTime = new Date(data['日期'] + " " + data['開始時間']);//開始時間
  var endTime = new Date(data['日期'] + " " + data['結束時間']);//結束時間
  var options = {};
  options['description'] = data['備註'];
  options['location'] = data['地點'];
   
  var color = 11;
  setCalendarTime(title, startTime, endTime, options, color)
   
}
//Line通知
function sendLineNotify(message){
  var options =
   {
     "method"  : "post",
     "payload" : {"message" : message},
     "headers" : {"Authorization" : "Bearer " + token}
   };
   UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
}
 
//日曆id
var googleCalendarID = "日曆id";
function setCalendar(title, startDate, description, color) {    
  startDate = new Date(startDate.replace(/-/g, "/"));//轉換日期格式 
    
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
    
  //沒有結束日期的全天事件
  var even = cal.createAllDayEvent(title, startDate, {description:description});
  
  //設定形成顏色
  even.setColor(color);  
}
function setCalendarTime(title, startTime, endTime, options, color=11) {   
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
    
  //建立事件
  var even = cal.createEvent(title, startTime, endTime, options);
  
  //設定形成顏色
  even.setColor(color);  
  //console.log(startTime);
}
function setCalendarTimeTest() {  
  var title = "標題";
  var startTime = new Date('2020/10/6 9:00:00 GMT+8');
  var endTime =  new Date('2020/10/6 11:00:00 GMT+8');
  var options = {};
  options['description'] = "描述";
  options['location'] = "育將電腦工作室";
  var color =11;
  
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
    
  //建立事件
  var even = cal.createEvent(title, startTime, endTime, options);
  
  //設定形成顏色
  even.setColor(color);  
  //console.log(startTime);
}
```
###   
 五、表單畫面
###   
   
 六、日曆畫面

 ```
//Line權杖
var token = "Line權杖"; 
function getFormData(e) {
  var ss = SpreadsheetApp.getActive();
  var ws = ss.getActiveSheet();
  var title = ws.getRange(1, 1, 1, ws.getLastColumn()).getValues()[0];//取得表單中文欄名
  //  console.log(title);
  var message = "\n\n";
  var data = {};
  for(i in title){
    if(title[i] !="時間戳記"){
      message += title[i] + ":" + e.values[i] + "\n\n";
    }
    data[title[i]] = e.values[i];
  }
  //通知Line
  sendLineNotify(message);  
    
  //通知日曆 
  //時間戳記	電子郵件地址	標題	主辦人	日期	開始時間	結束時間	地點	備註
    
  var title = data['標題'] + "-" + data['主辦人']; //日曆標題
  var startTime = new Date(data['日期'] + " " + data['開始時間']);//開始時間
  var endTime = new Date(data['日期'] + " " + data['結束時間']);//結束時間
  var options = {};
  options['description'] = data['備註'];
  options['location'] = data['地點'];
    
  var color = 11;
  setCalendarTime(title, startTime, endTime, options, color)
    
}
 
//Line通知
function sendLineNotify(message){
  var options =
   {
     "method"  : "post",
     "payload" : {"message" : message},
     "headers" : {"Authorization" : "Bearer " + token}
   };
   UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
}
  
//日曆id
var googleCalendarID = "日曆id";
function setCalendar(title, startDate, description, color) {    
  startDate = new Date(startDate.replace(/-/g, "/"));//轉換日期格式 
     
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
     
  //沒有結束日期的全天事件
  var even = cal.createAllDayEvent(title, startDate, {description:description});
   
  //設定形成顏色
  even.setColor(color);  
}
 
function setCalendarTime(title, startTime, endTime, options, color=11) {   
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
     
  //建立事件
  var even = cal.createEvent(title, startTime, endTime, options);
   
  //設定形成顏色
  even.setColor(color);  
  //console.log(startTime);
}
 
function setCalendarTimeTest() {
  var title = "222標題1111";
  var startTime = new Date('2020/10/10 9:00:00 GMT+8');
  var endTime =  new Date('2020/10/10 11:00:00 GMT+8');
  var options = {};
  options['description'] = "描述";
  options['location'] = "育將電腦工作室";
  var color =11;
   
  //透過ID取得日曆
  var cal = CalendarApp.getCalendarById(googleCalendarID);
     
  //建立事件
  var even = cal.createEvent(title, startTime, endTime, options);
   
  //設定形成顏色
  even.setColor(color);  
  //console.log(startTime);
}
```