[英]How to add a variable to the hyperlink function using Google Apps Script
[英]Google Apps Script, function to return text as hyperlink
我有一个Google Apps脚本函数SearchFiles()
,该函数根据用户提供的关键字返回下载网址。 它是这样的:
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信息嵌入到字符串中(例如<a href=downloadUrl>...</a>"
)。这可以在客户端解释为链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.