Javascript 在google应用程序脚本中使用isBlank()标记列

Javascript 在google应用程序脚本中使用isBlank()标记列,javascript,google-apps-script,compare,compare-and-swap,Javascript,Google Apps Script,Compare,Compare And Swap,如何在google应用程序脚本函数中使用isBlank() function pushGeo() { var ssA = SpreadsheetApp.openById('###') var ss = ssA.getSheetByName('mySheet'); var lastRow = ss.getLastRow(); var data = ss.getRange('G2:G'+lastRow); for(var row=2;row<=lastRow;row++) {

如何在google应用程序脚本函数中使用isBlank()

function pushGeo()
{
var ssA = SpreadsheetApp.openById('###')
var ss = ssA.getSheetByName('mySheet');
var lastRow = ss.getLastRow();
  var data = ss.getRange('G2:G'+lastRow);
  for(var row=2;row<=lastRow;row++) 
  {  
    ss.getRange('G'+row+':G'+row).isblank(); // not working
    if(isblank(data),'0','G'+row); // not working
  }
}
函数pushGeo()
{
var ssA=SpreadsheetApp.openById(“####”)
var ss=ssA.getSheetByName('mySheet');
var lastRow=ss.getLastRow();
var data=ss.getRange('G2:G'+lastRow);

对于(var行=2;行)如果在一个表上有大量的数据,您可能想考虑这样做,它运行得更快,因为您只需一次获得并设置所有数据。
function ifGIsBlankThenMakeItZero()
{
  var ssA = SpreadsheetApp.getActive();//changed from openById() for my convenience
  var ss = ssA.getActiveSheet();//change from getSheetByName() for my convenience
  var lastRow = ss.getLastRow();
  var range = ss.getRange(2,7,lastRow,1);//row 2 column 7 (G) lastRow 1 column 
  var data = range.getValues();//Gets all data
  for(var i=0;i<data.length;i++)//this runs over entire selected range 
  {  
    if(!data[i][0])//If true then it's blank
    {
      data[i][0]=0;//notice this is data[i][0] because there is only one column in the range.
    }
  }
  range.setValues(data);//Sets all data.  
}
函数ifGIsBlankThenMakeItZero() { var ssA=SpreadsheetApp.getActive();//为了方便起见,从openById()更改为 var ss=ssA.getActiveSheet();//为了方便起见,从getSheetByName()更改为 var lastRow=ss.getLastRow(); var range=ss.getRange(2,7,lastRow,1);//第2行第7列(G)lastRow第1列 var data=range.getValues();//获取所有数据
对于(var i=0;i)如果在一个表上有大量的数据,您可能想考虑这样做,它运行得更快,因为您只需一次获得并设置所有数据。
function ifGIsBlankThenMakeItZero()
{
  var ssA = SpreadsheetApp.getActive();//changed from openById() for my convenience
  var ss = ssA.getActiveSheet();//change from getSheetByName() for my convenience
  var lastRow = ss.getLastRow();
  var range = ss.getRange(2,7,lastRow,1);//row 2 column 7 (G) lastRow 1 column 
  var data = range.getValues();//Gets all data
  for(var i=0;i<data.length;i++)//this runs over entire selected range 
  {  
    if(!data[i][0])//If true then it's blank
    {
      data[i][0]=0;//notice this is data[i][0] because there is only one column in the range.
    }
  }
  range.setValues(data);//Sets all data.  
}
函数ifGIsBlankThenMakeItZero() { var ssA=SpreadsheetApp.getActive();//为了方便起见,从openById()更改为 var ss=ssA.getActiveSheet();//为了方便起见,从getSheetByName()更改为 var lastRow=ss.getLastRow(); var range=ss.getRange(2,7,lastRow,1);//第2行第7列(G)lastRow第1列 var data=range.getValues();//获取所有数据
对于(var i=0;该方法区分大小写。正确的拼写为
isBlank()
not
isBlank()
。请参阅该方法区分大小写。正确的拼写为
isBlank()
not
isBlank()
。请参阅