'Notifications with Checklist in Google Docs
I am sorry I dont know anything about coding but I am desperate to create a specific functionality. I want to create a checklist in a Google Doc and when different check boxes are checked it automatically prompts email notifications to different addresses. Can Google Apps Script do this? Can somehow help me understand how? Thank you!
Scott,
Solution 1:[1]
Email Dialog
Code.gs:
function displayCheckBoxes(chA) {
var ss=DocumentApp.getActiveDocument();
var html='';
for(var i=0;i<chA.length;i++) {
html+=Utilities.formatString('<br />%s', chA[i].value);
}
var userInterface=HtmlService.createHtmlOutput(html);
DocumentApp.getUi().showModelessDialog(userInterface, 'Checked Boxes');
}
function launchCheckboxDialog() {
DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutputFromFile('ah1'),'Email Dialog');
}
html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<input type="checkbox" id="chk1" name="Checks" value="Email 1 Sent" /><label for="chk1">Send Email 1</label>
<br /><input type="checkbox" id="chk2" name="Checks" value="Email 2 Sent" /><label for="chk2">Send Email 2</label>
<br /><input type="checkbox" id="chk3" name="Checks" value="Email 3 Sent" /><label for="chk3">Send Email 3</label>
<br /><input type="button" id="chkbtn" value="Send Selected Emails" onClick="saveChecks();" />
<script>
function saveChecks() {
var chA=document.querySelectorAll('input[type="checkbox"][name="Checks"]:checked');
var cbA=[];
console.log('Checkboxes: %s',JSON.stringify(chA));
for(var i=0;i<chA.length;i++) {
console.log('id: %s name: %s value: %s',chA[i].id,chA[i].name,chA[i].value);
cbA.push({id:chA[i].id,name:chA[i].name,value:chA[i].value});
}
google.script.run.displayCheckBoxes(cbA);
}
</script>
</body>
</html>
Demo:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cooper |

