Skip to content

Instantly share code, notes, and snippets.

@yoshimov
Created January 7, 2014 11:24
Show Gist options
  • Save yoshimov/8298006 to your computer and use it in GitHub Desktop.
Save yoshimov/8298006 to your computer and use it in GitHub Desktop.
GASで問い合わせ対応状況を1日に1回通知するスクリプト。
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