function gamEmail(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var first = sheet.getRange(lastRow, getColIndexByName("First Name")).getValues()[0];
var nickName = sheet.getRange(lastRow, getColIndexByName("Preferred Name")).getValues()[0];
if (nickName.isBlank() == true)
{var name = first;}
else
{name = nickName;}
var last = sheet.getRange(lastRow, getColIndexByName("Last Name")).getValues()[0];
var mobile = sheet.getRange(lastRow, getColIndexByName("Mobile Phone")).getValues()[0];
var office = sheet.getRange(lastRow, getColIndexByName("Office")).getValues()[0];
var subject = "**GAM New User**" + " " + name + " " + last;
此脚本为新用户设置GAM命令行,name变量必须是新用户的名字,除非他们有nickName。然后我需要将name变量设置为nickName。我似乎无法找到答案。有什么建议?提前谢谢。