title: Macro to list active users
body: <p>Sorry, a total newby to Google Sheets here, but with reasonable vba experience.</p>
  
  <p>I'm trying to create an active list of active users in a hidden sheet that could then be used to highlight the existence of those users with a conditional format and vlookup.</p>
  
  <p>Can this work in Sheets?</p>
  
  <p>So far, I have the code below, but it's early days, and this only seems to list the one user that activated the code, rather than all.
  I think I can see why that is but I'm finding it really difficult to find resources to help me along (again - a newby to Sheets).</p>
  
  <pre><code>function GetUserNames() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sht = ss.getSheetByName("ActiveUsers");
  // Log the email address of the person running the script.
  var email = Session.getActiveUser().getEmail();
  Logger.log(email);
  //SET CELL A1 TO EMAIL ADDRESS OF ACTIVE USERS
  sht.getRange(1,1).setValue(email);
  }
  </code></pre>
  
  <p>My plan is to run this with a From spreadsheet - On open trigger.
  Is that the preferred option for such things?
  I haven't begun to look at the hidden sheet aspect but presume that will work OK, even if my script has to un-hide/re-hide it each time?</p>