如何在excel单元格中插入链接

Bal*_*sky 2 google-apps-script

我用谷歌应用程序脚本生成excel 如何在excel单元格中插入链接到网页?

小智 5

你需要使用'setFormula'而不是'setValue':

例如:

var ss = SpreadsheetApp.getActiveSheet();
var destinationCell = ss.getRange(1,1);
var link = "http://www.google.com";
var displayName = "My Link";
destinationCell.setFormula("=hyperlink(\""+link+"\";\"" + displayName + "\")");
Run Code Online (Sandbox Code Playgroud)