I am just learning to play with scripts and cannot get a script to hide and show a specific row to work on the sheet I want to apply the script to. I have a google sheet I created as a sandbox where it does work but once I copy the script and assign the script to a button the "show" function does not work while the hide function continues to.
All I'm trying to do is hide row 3 and then be able to unhide the same row on this sheet.
/** @OnlyCurrentDoc */
function hide() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('3:3').activate();
spreadsheet.getActiveSheet().hideRows(spreadsheet.getActiveRange().getRow(), spreadsheet.getActiveRange().getNumRows());
spreadsheet.getRange('4:4').activate();
};
function show() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('4:4').activate();
spreadsheet.getActiveSheet().showRows(3, 1);
};
There are no errors, the script runs to completion without any visible changes to the sheet(the row is still hidden)