Hi team,
I want a feature where we can integrate g suite domain so that i can able to fetch all the users and admins and it should be in sync with the g suite account.
The main reason for this feature is I can able to restrict the certain views for normal users and can give full access to all views to admins in the g suite.
It would be greate if any other ways to achieve it instead of adding manually in the sheets everytime
Solved! Go to Solution.
@adithya98 Sounds like you need to enable the advanced service under Resources -> Advanced Google Services -> Slide the service for AdminDirectory to on and hit ok.
I think this is a great feature request!
As an automated workaround, you may be able to create a Google script which can retrieve the G-Suite users and insert them into your AppSheet app users table. I donโt know of an automated way to add users to the appโs user whitelist (anyone else?) so that may still need to be performed manually but you could have the script send an email when a new user needs to be added.
Thanks @WillowMobileSystems I am trying this Google Script which is attached to the spreadsheet of my Appsheet app ``` function myFunction() {
var sh = โ11KKjcV-ixYt6EWhs_k6Jb2ctMJeXWH3uSX4W4sHqniUโ; //This line will specify which Spreadsheet to Open//
var sheet = SpreadsheetApp.openById(sh);
var sheet1 = sheet.getSheetByName(โGoogle Usersโ);
var sheet1range = sheet.getRange(โA:Fโ)
sheet1range.clear()
var data = ;// array to store values
data.push([โEmailโ ,โFirstnameโ, โLastnameโ, โSuspendedโ, โLastLoginTimeโ,โCreationโ]);// store headers
var pageToken, page;
do {
page = AdminDirectory.Users.list({
domain: 'domainname',
pageToken: pageToken
});
var users = page.users;
if (users) {
for (var i = 0; i < users.length; i++) {
var user = users[i];
data.push([user.primaryEmail, user.name.givenName, user.name.familyName, user.suspended, user.lastLoginTime , user.creationTime ]);//store in an array of arrays (one for each row)
}
} else {
Logger.log('No users found.');
}
pageToken = page.nextPageToken;
} while (pageToken);
sheet1.getRange(1,1,data.length,data[0].length).setValues(data);
var dated = sheet.getRange(โP1โ)
dated.setValue(Utilities.formatDate(new Date(),Session.getScriptTimeZone(),โdd-MMM-yyyโ));
} ```
but it shows error ReferenceError: AdminDirectory is not defined someone please help
@adithya98 Sounds like you need to enable the advanced service under Resources -> Advanced Google Services -> Slide the service for AdminDirectory to on and hit ok.
Thanks @JTL Its working!!
User | Count |
---|---|
61 | |
25 | |
14 | |
11 | |
6 |