Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* MemoSendLINE
* GoogleHomeからお買い物メモをLINEで通知する
*/
function doGet(e) {
// Googleスプレッドシートから買い物メモを取得
var ss = SpreadsheetApp.openById("<スプレッドシートのID>");
var sheet = ss.getSheetByName("shopping");
var msg = "\n*****[お買い物メモ]******\n";
for(var i=1;i<=sheet.getDataRange().getLastRow();i++){
msg = msg + sheet.getRange(i, 2).getValue() + "\n";
}
msg = msg +"**********************";
// メッセージ送信
sendLineMsg(msg);
}
/**
* LINE Notifyでルームにメッセージを送る
* @param {var} message 送信するメッセージ
*/
function sendLineMsg(message){
var token = "<取得したトークン>";
var options = {
"method" : "post",
"payload" : "message="+message,
"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
You can’t perform that action at this time.