Can you please help me to make a custom script so that i can hide and show a specific nameRanged in Google Spreadsheet.
This is the sample code that im using:
function onOpen() {
var menu = [{name: "Hide Daily Columns", functionName: "hideColumns"}, {name: "Show Daily Columns", functionName: "showColumns"}]
SpreadsheetApp.getActiveSpreadsheet().addMenu("My Views", menu); }
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var name = ss.getRangeByName("sample1");
function hideColumns() {
sheet.hideColumn(name);
}
function showColumns() {
sheet.showColumns(Name);
}
Note: the problem here is the .showColumns there's error promp. Cannot convert range into class.
Thanks!