检查单元格是否为空(n1),如果为空则放置消息。如果不是空的可以处理功能

时间:2016-10-10 15:54:23

标签: if-statement google-apps-script

// function to tranfer data to another Execl. 
function transfer() 
{ 
  // mark N1 as cell  
  var cell = SpreadsheetApp.getActive().getRange('N1'); 
  var rule = SpreadsheetApp.newDataValidation().requireDateAfter(new Date('2016/10/09')).build();
  cell.setDataValidation(rule);

  //if cell (N1) is empty then put messege box 
  if(cell == "")
  { 
    Browser.msgBox("need to place a date"); 
  } 
  //else make the function 
  else 
  { 
    Browser.msgBox("date "); 
    //Cource sheets 
    var sss = spreadsheetApp.openById('1NcAn2Jvlw_nDsiQEx64HrvsIOPdtoRFj6kAAbluOmOY'); 
    var ss = sss.getSheetByName('tips');  
    var range = ss.getRange('A35:H35');   
    var data = range.getValues();


    // Destination Sheet  
    var tss = SpreadsheetApp.openById('1ELiI8vmvhAVkEj6qUz6AnzqzZBbNtcY5NSK9dZINr0c');
    var ts = tss.getSheetByName('Olga');   
    ts.getRange(ts.getLastRow()+1, 1,1,8).setValues(data);  
  } 

}

0 个答案:

没有答案