So I'm pretty new when it comes to scripts. In the past I was able to get a small script to work, but that was an isolated event and it was mostly copy/pasting anyway. I'm working in a google sheets. Here's what I'm trying to accomplish:
I want my sheet to Hide/Show certain columns based on the content of a single cell, C3. I was able to find a script that should be working based on this post, but no matter what I do the script isn't affecting any changes to my sheet. Below is my modified version of the script. The main difference is that Omar only wanted 3 separate views, whereas I want 13, one for each calendar month and one that displays all. I'll include 3 cases for spaces sake.
function onEdit(e) {
var sheet = e.source.getActiveSheet();
if (e.range.getA1Notation() !== 'C3' || sheet.getName() !== 'Overview') return;
switch (e.value) {
case 'All':
sheet.showColumns(1, sheet.getMaxColumns()-1)
break;
case 'January':
sheet.showColumns(1, 2, 3, 4, 5, 26, 27)
sheet.hideColumns(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)
break;
case 'February':
sheet.showColumns(1, 2, 3, 4, 5, 6, 7)
sheet.hideColumns(8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27)
break;
}
}
I feel like the script should be working, and perhaps I missed some small implementation step. Any help?