如何运行Google表格中的Google Doc ID循环

我正在尝试在App脚本中运行循环,但是该脚本在第二次通过循环时会停止。

Google文档ID来自Google表格中的列表。我可以使其不循环运行,但是工作表范围一旦更新,就不会查看下一个ID。谁能看到哪里出了问题?

function myFunction() {
  var ss = Spreadsheetapp.openById('1LETEuEdYxyIxQtQgFWTwm3GgZWDAR5ehUUEIh_jN7zA');
  var sheet = ss.getSheetByName('Sheet1');
  var lr = sheet.getRange(2,5).getDataRegion(Spreadsheetapp.Dimension.ROWS).getLastRow();

  for(var i=0; i<lr+1; i++) { 
    var id = sheet.getRange(i+2,5,1,1).getvalue();
    var doc = DocumentApp.getactiveDocument();
    var docInside = DocumentApp.openById(id).getBody();
    var text = docInside.getTables();
    var table = text[3].getNumRows();
    var val = text[3].getRow(2).getText();
    var pasteArea = doc.editAsText();

    pasteArea.appendText(val);

    var text = docInside.getTables();
    var loops = text[7].getNumRows();

    for(var i=0; i<loops-5; j++) { 
      var val = text[7].getRow(j+5).getText();
      var pasteArea = doc.editAsText();

      pasteArea.appendText(val);
    }
  }
};
HWSGCH 回答:如何运行Google表格中的Google Doc ID循环

尝试一下:

$("#nodes").change(function() {
    $("#date").empty();
});

$("#nodes").change(function() {
    $("#date").val("").datepicker(clear);
});

$("#nodes").change(function() {
    $("#date").data(datepicker).clear()
});
本文链接:https://www.f2er.com/3135197.html

大家都在问