Joh*_*ssi 1 html javascript popup google-sheets google-apps-script
我喜欢使用弹出窗口来检索补充信息。
但正如你所看到的,我想将数据排列到某种表格中,以使其看起来更合适。
所以问题很简单:有没有办法在 Google Apps 脚本中插入某种 htmlsetNote()或者可以提出某种 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");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2194 次 |
| 最近记录: |