0

此代码有效,但是,我希望为工作表的 url 显示一个漂亮的名称,link而不是显示url. 我知道如何做到这一点=hyperlink,但在这里,我不知所措:

  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.clearContents();
  sheet.appendRow(["Link", "Name", "Type", "ID"]);
  for (var i = 0; i < contents.length; i++) {
    file = contents[i];
    var value1,value2,value3;
    if (file.getFileType()==DocsList.FileType.SPREADSHEET) {
      var otherSheet = SpreadsheetApp.open(file).getSheetByName("Sheet1");
      value1 = otherSheet.getRange('B2').getValue();
      value2 = otherSheet.getRange('B7').getValue();
      value3 = otherSheet.getRange('B3').getValue();
    } else {
      value1 = null; value2 = null; value3 = null; value4 = null;
    }
    sheet.appendRow([ file.getUrl(),value1,value2,value3,value4]);
  }
};
4

1 回答 1

1

我想到了!我补充说:

var name = "link"; 
var semi = ";";
var hyp = "=hyperlink(\""; var quot = "\""; var clos = ")";
var pp = hyp + url + quot + semi + quot + name + quot + clos;

然后改成sheet.appendRow)[link, value1...

于 2013-05-31T14:34:33.010 回答