Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save apivat60/fcabcd8098c3d606ec15e3ae2072387d to your computer and use it in GitHub Desktop.
Save apivat60/fcabcd8098c3d606ec15e3ae2072387d to your computer and use it in GitHub Desktop.
var token='ใส่TokenLine';
var url='';
function myFunction() {
var ss = SpreadsheetApp.openById('ใส่ชีตID');
var sheet = ss.getSheetByName('ใส่ชื่อแผ่นงาน');
var name = sheet.getRange(sheet.getLastRow(), 2,1).getValue();
url = sheet.getRange(sheet.getLastRow(), 3,1).getValue().split('=')[1];
var date = Utilities.formatDate(new Date(), 'GMT+7', 'dd/MM/YYYY');
var msg = 'รายงานการปฏิบัติงานของ '+name+' วันที่ '+date;
sendLineNotify(msg);
}
function sendLineNotify(message) {
var picURL = 'https://drive.google.com/uc?export=view&id='+url
var formData = {
'message' : message,
'imageThumbnail': picURL,
'imageFullsize' : picURL}
var options = {
"method" : "post",
"payload" : formData,
"headers" : {"Authorization" : "Bearer " + token}};
UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment