Google Spreadheets Scripts: check if cell is empty

前端 未结 3 1046
無奈伤痛
無奈伤痛 2020-12-06 04:14

I want to input a variable in a cell only if the cell is empty. The if statement, however, does not work. Any advice?

var ss=SpreadsheetApp.getActiveSpreadsh         


        
3条回答
  •  盖世英雄少女心
    2020-12-06 05:03

    Try:

    function myFunction() {
      var ss=SpreadsheetApp.getActiveSpreadsheet();
      var s=ss.getSheetByName('odpovědi')
      var lr=s.getLastRow()  
      var ax=s.getRange(lr, 10).getValue();
         if(ax == ""){
            ax = "foo";
            s.getRange(lr, 10).setValue(ax);
      }
      }
    

提交回复
热议问题