The following Google Apps Script is designed to loop through all protected ranges and get their name. With this ability we could choose to do more in future such as removing the protection, modifying who has access, etc but for now we just demonstrate returning the name.
The below line gets an array of objects representing all protected ranges in the spreadsheet:
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);With this simple loop we can then extract the names:
for (var i=0; i<protections.length; i++) {
var name = protections[i].getRangeName();
Logger.log('Named range is: ' + name);
}
Search for protected named ranges.xlsx
No comments:
Post a Comment