gpt4 book ai didi

javascript - 将 HTML 插入到 Google 表格的弹出窗口或注释中

转载 作者:行者123 更新时间:2023-11-28 14:11:17 25 4
gpt4 key购买 nike

我喜欢使用弹出窗口来检索补充信息。

enter image description here

但正如你所看到的,我想将数据排列到某种表格中,以使其看起来更合适。
所以问题很简单:有没有办法在 Google Apps 脚本中将某种 html 插入到 setNote() 中,或者可以提出某种 DIY 弹出窗口?

我当然是在谈论原始的 Web 应用程序。

最佳答案

简单对话框

此函数会将 A 列和 B 列中的所有内容放入无模式对话框中的表中。这一切都在谷歌脚本中。

function simpleDialog() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
var rg=sh.getRange(2,1,sh.getLastRow()-1,2);
var vA=rg.getValues();
var html='<html><head><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"><script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script></head><body>';
html+='<style>th,td{border:1px solid black;}</style><table>';
html+=Utilities.formatString('<tr><th>%s</th><th>%s</th></tr>',"Asset","Rate");
vA.forEach(function(r,i){
html+=Utilities.formatString('<tr><td>%s</td><td>%s</td></tr>',r[0],r[1]);
});
html+='</table><br /><input type="button" value="Exit" onClick="google.script.host.close();" />';
html+='</body></html>';
var userInterface=HtmlService.createHtmlOutput(html);
SpreadsheetApp.getUi().showModelessDialog(userInterface, "Data Dialog");
}

关于javascript - 将 HTML 插入到 Google 表格的弹出窗口或注释中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59343931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com