Reputation: 21
In Google Apps Script, is there any way to check if any users besides myself are currently editing a sheet? I don't really need to know much about those users — just knowing whether anyone else has the sheet open in a browser window would suffice.
My goal is to automatically re-sort a sheet every hour or so, but only if no other users are connected to the sheet, so as to avoid interfering with their work. I can't seem to find any information on how to programatically access the list of currently connected users, though.
Thanks in advance!
Fran
Upvotes: 2
Views: 1121
Reputation: 440
Add this script to your script editor. Every time a cell on any sheet is edited it will popup a small message stating user email for 2 seconds:
function onEdit(e) {
var user = Session.getEffectiveUser().getEmail();
SpreadsheetApp.getActiveSpreadsheet().toast('User working: '+user, 'Info', 2);
}
Upvotes: 1