Google apps script 如何通过代码打开多个url,我们有一个代码,但它只适用于一个url

Google apps script 如何通过代码打开多个url,我们有一个代码,但它只适用于一个url,google-apps-script,Google Apps Script,我们有下面的脚本,我们正在谷歌脚本编辑器中运行它,它工作正常,但它只打开一个url,如果我们想打开多个url,我们如何才能做到这一点 功能是 function myFunction() { var js = " \ <script> \ window.open('https://stackoverflow.com/', '_blank', 'width=800, height=600'); \ google.script.host.clo

我们有下面的脚本,我们正在谷歌脚本编辑器中运行它,它工作正常,但它只打开一个url,如果我们想打开多个url,我们如何才能做到这一点

功能是

function myFunction() {
  var js = " \
    <script> \
      window.open('https://stackoverflow.com/', '_blank', 'width=800, height=600'); \
      google.script.host.close(); \
    </script> \
  ";
  var html = HtmlService.createHtmlOutput(js)
    .setHeight(10)
    .setWidth(100);
  SpreadsheetApp.getUi().showModalDialog(html, 'Now loading.'); 
}
函数myFunction(){
var js=”\
\
打开窗户https://stackoverflow.com/","空白","宽800,高600",\
google.script.host.close()\
\
";
var html=HtmlService.createHtmlOutput(js)
.设置高度(10)
.设置宽度(100);
SpreadsheetApp.getUi().showmodaldialdialog(html,“正在加载”);
}
使用
窗口。打开
您可以打开任意多个窗口 在两个不同窗口中打开两个URL的示例:

函数myFunction(){
var js=”\
\
打开窗户https://stackoverflow.com/","空白","宽800,高600",\
打开窗户https://www.wikipedia.org/","空白","宽800,高600",\
google.script.host.close()\
\
";
var html=HtmlService.createHtmlOutput(js)
.设置高度(10)
.设置宽度(100);
SpreadsheetApp.getUi().showmodaldialdialog(html,“正在加载”);
}

我不知道谷歌应用程序脚本,但在javascript/html中,您只需使用几个window.open()即可;在打开所有链接之前,代码不会终止。请澄清“打开多个url”是什么意思?你能把不起作用的代码贴出来吗?据我所知,你发布的代码运行良好。你是对的,上面的代码正在运行,现在我们想知道如果我们想打开多个url,我们如何才能做到这一点。需要做哪些更改或将多个URL放在何处打开这在vba中对我来说很好,但现在我们想使用google脚本``Dim r As Range为Range(“b2”,Range(“b2”).End(xlDown))ActiveWorkbook.FollowHyperlink(r)应用程序执行此操作。Wait调用了名为()的下一个r End子函数As Date Dim newHour As Long Dim newMinute As Long Dim newSecond As Long Dim waitTime As Date newHour=Hour(Now())newMinute=Minute(Now())newSecond=Second(Now())+5 waitTime=TimeSerial(newHour,newMinute,newSecond)调用=waitTime End函数``如果您想让我们将VBA转换为应用程序脚本,您来错了地方