Created
November 4, 2020 10:03
-
-
Save apivat60/fcabcd8098c3d606ec15e3ae2072387d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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