Hey everyone,
im kinda new in google sheets and google apps script. First i got a code where a sheet is hidden, if the checkbox in a specific cell is checked.
function onEdit(a) {
var range = a.range;
if (range.getA1Notation() == "B13") {
var Agenda = a.source.getSheetByName("Agenda");
if (range.isChecked()) {
Agenda.showSheet();
} else {
Agenda.hideSheet();
}
}
}
Now i got the problem that i have multiple sheets. But this code shall only work in one of the sheets.
So i tried two different things:
if (activeSheet.getName() !== "Allgemeine Informationen") return;
and
if (activeSheet.getName() == "Allgemeine Informationen") {
...
}
Both doesn’t work properly.
I also tried to get the value of the function by writing the value of “activeSheet.getName()” in a cell but the cell kept empty.
So Long Text Short Question: How can i put an if function that makes the code only executing when the active sheet has the name “Allgemeine Informationen”?
Friendly Regards