I would like to prevent a user from deleting/adding rows and columns on my Google Sheet, however, when I protect the sheet, I can't specifically ask it to just prevent those, it blocks data entry, hiding/unhiding rows/columns etc. What I thought about is to put a checkbox on a cell, so the user can still hide/unhide certain rows if needed, however, my script doesn't work when the sheet is protected.
function onEdit(e) {
var sheetName = 'Fund Request';
var sh = SpreadsheetApp.getActive().getSheetByName(sheetName),
status = sh.getRange('A20').getValues();
function showHideRow(v, i) {
// [[row, numberRows]]
var rows = [[21,180]];
return v[0]
? sh.showRows.apply(sh, rows[i])
: sh.hideRows.apply(sh, rows[i])
};
status.forEach(showHideRow);
}
Any ideas? Would be nice if a user can still use the sheet normally except for adding/deleting rows and columns even though it's protected.
Would be nice if a user can still use the sheet normally except for adding/deleting rows and columns even though it's protected.
. I apologize for this. Can I ask you about the detail of your goal? - Tanaike