if else语句赢得了空白单元格与单元格的值

时间:2014-07-23 17:59:27

标签: javascript

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。我似乎无法找到答案。有什么建议?提前谢谢。

0 个答案:

没有答案