我在尝试运行脚本时遇到错误。 Google电子表格

时间:2013-01-28 09:24:03

标签: google-apps-script

我有一个脚本,但它不起作用:

    function onOpen(e){
  var sheet = Spreadsheet.getActiveSheet();

  //Load all the URLs
  var urls = sheet.getRange("A:A").getValues();

  //Initialize array for content
  var text = [];

  //Loop through URLs
  for(var i = 0; i < urls.length; i += 1){
    //Fetch the webpage, push the content to the array (inside an array since it needs to be 2d)
    text.push(
      [UrlFetchApp.fetch(urls[i][0]).getContentText()]
    );
  }
  //Store text in spreadsheet
  sheet.getRange("B:B").setValues(text);
}

它继续前进,但卡在字符串13中:属性被指定为没有值:url(字符串·13)。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

第二行有错误。它应该是:

var sheet = SpreadsheetApp.getActiveSheet();