0

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

    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)。有任何想法吗?

4

1 回答 1

0

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

var sheet = SpreadsheetApp.getActiveSheet();
于 2013-01-28T09:39:10.207 回答