If anyone can offer advice about why this function isn’t working, I would appreciate it. It’s basically copied right out of the Google API reference: https://developers.google.com/apps-script/class_pageprotection#getUsers
function getUsers() {
var sheet = SpreadsheetApp.getActiveSheet();
var permissions = sheet.getSheetProtection();
var users = permissions.getUsers();
Browser.msgBox(users);
}
When I run the script, I get an empty box with the title “Apps Script” and no list of users.
Any help would be greatly appreciated. Thanks!
Jessica
That function only returns values when sheet protection is enabled (by selecting Tools – Protect Sheet).
When the sheet is protected, the function will return the list of users you granted access to and the code will work as expected.