Created
October 22, 2020 15:21
-
-
Save apivat60/3e2321ff3b5b1aa0eb58dd3493e49f45 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
function myFunction() { | |
var token = 'token line'; | |
var sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0]; | |
var sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheets()[1]; | |
var name = sheet2.getRange('ระบุเรนจ์รายชื่อนักเรียน').getValues(); | |
var data = sheet1.getRange(sheet1.getLastRow(), 2,1,sheet1.getLastColumn()).getValues()[0]; | |
var date = Utilities.formatDate(new Date(), 'GMT+7', 'dd/MM/YYYY'); | |
var msg = 'สรุปการมาเรียนวันที่ '+date; | |
for(var i = 0;i<name.length;i++){ | |
msg+='\n'+name[i]+':'+data[i]; | |
} | |
sendLineNotify(msg,token); | |
} | |
function sendLineNotify(message,token) { | |
var picURL = 'https://drive.google.com/uc?export=view&id=ใส่ไอดีรูปภาพ' | |
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