Title1

Title2

Title3

2-1 Google表單+ Mail通知填報者+ Mail通知整理者 + Line通知+日曆通知

一、GAS
lmX8VuVMlvaKFNTfuvtORKdYITFvFzlDs8TnpsuEMEg

//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 startDate = data['繳費日期'];//日期
  var description = data['繳費單位'] + "-" + data['繳費日期'] + "-" + data['繳費金額'];//日曆內容  
  var color = 11;
  setCalendar(title, startDate, description, color);
  
}
 
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);  
}

二、