Sign in Action Button

@Jen_NYCP - just for a bit of fun, I coded up something that would automatically change the image back. I’ve tested it, and it works fine, albeit with a short delay.

function enforce_profile_image(event) {
  var profile_sheet_name = 'Users';  // Replace with the name of your user profiles sheet
  var image_col = 4; // Replace this with the column number that contains the image (A=1, B=2, C=3, etc)
  var image_url = 'https://randomuser.me/api/portraits/women/74.jpg'; // Replace this with the URL of your logo
  
  var sheetname = event.source.getActiveSheet().getName();
  if (sheetname != profile_sheet_name) {
    return;
  }
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName(sheetname);
  var data = sheet.getRange(2,image_col, sheet.getLastRow()-1, 1).getValues();
  data.forEach(function (row) {
    row[0] = image_url;
  });
  sheet.getRange(2,image_col, sheet.getLastRow()-1, 1).setValues(data);
} 

You would use that with an On Change trigger. If you’re not sure how to configure triggers, I covered this in a recent tutorial (Part 4). If you wanted to use it, note that you’d need to replace the variable values on the first 3 lines.

2 Likes