Created
January 7, 2014 11:24
-
-
Save yoshimov/8298006 to your computer and use it in GitHub Desktop.
GASで問い合わせ対応状況を1日に1回通知するスクリプト。
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 checkNotification() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var cell = sheet.getRange("G2"); | |
var notify = false; | |
var str = ""; | |
while (!cell.isBlank()) { | |
if (cell.getValue().toString() == "未") { | |
notify = true; | |
str += cell.offset(0, -6).getValue() + "番の問い合わせに未回答です。\n"; | |
str += "担当は" + cell.offset(0, -1).getValue() + "さんです。\n"; | |
} | |
cell = cell.offset(1, 0); | |
} | |
if (notify) { | |
sendNotify(str); | |
} | |
} | |
function sendNotify(message) { | |
var recipient = UserProperties.getProperty("address"); | |
var subject = UserProperties.getProperty("subject"); | |
var header = "問い合わせ状況自動通知メールです。\n\n"; | |
var footer = "\n問い合わせ対応状況シート: " + SpreadsheetApp.getActive().getUrl(); | |
MailApp.sendEmail(recipient, subject, header + message + footer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment