Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Google应用程序脚本,以超链接形式返回文本的函数_Javascript_Google Apps Script - Fatal编程技术网

Javascript Google应用程序脚本,以超链接形式返回文本的函数

Javascript Google应用程序脚本,以超链接形式返回文本的函数,javascript,google-apps-script,Javascript,Google Apps Script,我有一个谷歌应用脚本函数SearchFiles(),它根据用户提供的关键字返回下载URL。是这样的: function SearchFiles(inputValueFromUser) { var searchFor ='title contains "' + inputValueFromUser + '"'; var searchForAbsString = inputValueFromUser + '.pdf' ; //The Rest of the Code goes he

我有一个谷歌应用脚本函数
SearchFiles()
,它根据用户提供的关键字返回下载URL。是这样的:

function SearchFiles(inputValueFromUser) {


  var searchFor ='title contains "' + inputValueFromUser + '"';
  var searchForAbsString = inputValueFromUser + '.pdf' ;

  //The Rest of the Code goes here

    if(file.getName() == searchForAbsString){
    downloadURL = "https://drive.google.com/uc?export=download&id=" + fileId;
    arryOfUrls.push(downloadURL);
    };
  };

  Logger.log('arryOfUrls: ' + arryOfUrls);
  return arryOfUrls;//.toString(); //Send array of download urls back to client side JavaScript 
};
函数以纯文本形式返回
arryOfUrls

1) 如何以超链接形式发送?
2) 点击相应的按钮(在
Index.html
)获取链接时,是否可以自动打开URL(立即开始下载)?

不,它不能直接作为超链接发送(至少据我所知不是这样)。但是您可以将HTML信息嵌入字符串(如
)。这可以在客户端解释为链接。

不,它不能直接作为超链接发送(至少据我所知不是这样)。但是您可以将HTML信息嵌入字符串(如”我以前是这样想的,但不要尝试。非常感谢…它很有效。请将其作为答案发布,以便我可以将其标记为正确。