Javascript 根据电子表格中的数据填充html输入框
我正在使用google sheets上的脚本自动化一个过程。 我有一个html,左边有4个输入框,右边有4个输入框 当用户在右侧的输入框中输入数字并单击“计算”按钮时,我将输入数据添加到电子表格中,并对每个值应用标记。我将它们存储在单元格A2:D2中(所有这些都正常工作) 我想将这些值(以及通过常规gsheets公式计算的标记)返回到左侧的4个输入框中 我不知道如何将我在电子表格中计算的值带到左侧的输入框中 函数“getValues” 输入框的HTML(4)Javascript 根据电子表格中的数据填充html输入框,javascript,google-apps-script,google-sheets,web-applications,client-server,Javascript,Google Apps Script,Google Sheets,Web Applications,Client Server,我正在使用google sheets上的脚本自动化一个过程。 我有一个html,左边有4个输入框,右边有4个输入框 当用户在右侧的输入框中输入数字并单击“计算”按钮时,我将输入数据添加到电子表格中,并对每个值应用标记。我将它们存储在单元格A2:D2中(所有这些都正常工作) 我想将这些值(以及通过常规gsheets公式计算的标记)返回到左侧的4个输入框中 我不知道如何将我在电子表格中计算的值带到左侧的输入框中 函数“getValues” 输入框的HTML(4) NL 荷兰  欧元 在h
NL
荷兰
 欧元
在html中,我有以下脚本:
function afterButtonClicked(){
document.getElementById("price_netherlands").value = "My value"
google.script.run.getValues(); }
document.getElementById("Calculate_WSP").addEventListener("click", afterButtonClicked);
</script>
函数afterButtonClicked(){
document.getElementById(“价格”)value=“我的价值”
google.script.run.getValues();}
document.getElementById(“计算”\u WSP”).addEventListener(“单击”,点击后按钮);
我不知道如何用脚本“getValues”返回的信息替换“my value”。Html(单击按钮后)
GS
欢迎来到stackoverflow!请注意,为了帮助您解决问题,如果您能提供到目前为止您拥有的脚本,以及可以可视化问题的示例电子表格和/或图像,将会更容易。感谢您的反馈。我包含了部分代码。您是否阅读了有关
google.script.run
的所有相关文档?没有。我没有技术背景,这是我第一次尝试。我看了很多视频,读了很多文章,能够在两周内学到足够的东西来构建这个平台。如果您能指出我可以在官方文件中学习和研究的材料,我将不胜感激:
<tr>
<th scope="row">NL</th>
<td>Netherlands</td>
<td> <div class="input-group-prepend">
<span class="input-group-text"> € </span>
<input style="width: 120px" type='number' class="form-control" id="price_netherlands"> </td>
<td> </td>
function afterButtonClicked(){
document.getElementById("price_netherlands").value = "My value"
google.script.run.getValues(); }
document.getElementById("Calculate_WSP").addEventListener("click", afterButtonClicked);
</script>
google.script.run.withSuccessHandler(onSuccess).getValues();
function onSuccess(temp) {
temp.forEach(function(r){
var nee= document.getElementById('price_netherlands');
nee.value = r[0]});
}
function getValues()
const ss = SpreadsheetApp.getActiveSpreadsheet();
const ws = ss.getSheetByName("GeneratedWSP");
var temp = ws.getRange("A2:V2").getValues();
Logger.log(temp);
return temp;