**Hello All, I would like seek help on below google sheet script which is when the checkbox is checked it cannot auto send email with data column A to E and script i need to add?
const wholeSheet = SpreadsheetApp.getActive();
let sheetName = "name of your sheet";
let activeSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
function sendEmailWhenBoxIsChecked() {
let columnIndexOfCheckbox = 6; //column index of where your checkbox is located
let rowIndexOfCheckbox = 2; //column index of where your checkbox starts
let activeCellOfActiveSheet = activeSheet.getActiveCell();
if (
activeCellOfActiveSheet.getColumn() === columnIndexOfCheckbox
&& activeCellOfActiveSheet.getRowIndex() >= rowIndexOfCheckbox
&& !activeCellOfActiveSheet.isBlank()
) {
let checkbox = activeSheet.getActiveCell();
if (checkbox.isChecked()) {
GmailApp.sendEmail("recipient email", "Email header", "Email content or body");
}
}
}
function onEdit() {
let createTrigger = true;
ScriptApp.getProjectTriggers().forEach(trigger => {
if (trigger.getEventType() === ScriptApp.EventType.ON_EDIT && sendEmailWhenBoxIsChecked.name === trigger.getHandlerFunction()) createTrigger = false;
});
if (createTrigger) {
ScriptApp.newTrigger(sendEmailWhenBoxIsChecked.name)
.forSpreadsheet(wholeSheet)
.onEdit()
.create();
}
}