I have little to no experience with google scripts, and I find myself in a pickle. I want to execute a script when a checkbox is checked. I got this working. The problem is i can't make the script take into account other checkboxes - say i have 3 options for the script -> log ALL, log only fruits and add the store. It runs when i click RUN, but it won't take into account my "log fruit" checkbox. At the end it will set the checkbox that runs the script back to FALSE.
function onEdit(e) {
const sh = e.range.getSheet();
if (e.range.columnStart == 6 && e.range.columnEnd == 6 && e.range.rowStart == 7 && e.range.rowEnd == 7 && e.value == "TRUE") {
if (e.range.columnStart == 6 && e.range.columnEnd == 6 && e.range.rowStart == 4 && e.range.rowEnd == 4 && e.value == "TRUE") {
sh.getRange(e.range.rowStart, 6).setValue(10);
}
sh.getRange(e.range.rowStart, 8).setValue(20);
sh.getRange(e.range.rowStart, 6).setValue("FALSE");
}
}
Any ideas ?
Aucun commentaire:
Enregistrer un commentaire