【发布时间】:2019-07-28 03:14:41
【问题描述】:
这将被部署为一个网络应用程序,我需要从 Google 工作表文档中获取一系列值并将其显示在我的 HTML 表单上。
我需要从 temp 变量中获取单元格值并将其传递给文本表单。到目前为止,我有应用脚本的代码,但我不知道如何将它传递给 HTML 表单。
Code.gs //Google App 脚本的代码
function getValues()
{
var app = SpreadsheetApp;
var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
var temp = activeSheet.getRange("A1:C1").getValues();
Logger.log(temp); //I need to get the values from the temp variable and pass it to the text forms.
}
Index.html //HTML 索引页面
<form>
A1:<br>
<input type="text" name="a1" value="">
<br>
B1:<br>
<input type="text" name="b1" value="">
<br>
C1:<br>
<input type="text" name="b1" value="">
<br><br>
<input type="submit" value="Fetch">
</form>
【问题讨论】:
-
我认为这个答案可能对您有所帮助:stackoverflow.com/a/56479763/7215091
-
这是另一个 webapp 示例:stackoverflow.com/a/56819742/7215091。您也可以使用 html 模板和脚本来完成。
标签: javascript google-apps-script google-sheets-api