可以检索在Electron 表格的单元格中输入的信息. 接下来,如何将以HTML格式获得的信息作为初始值插入到文本字段中? 到目前为止,我已经创建了它,但我不能在初始值中动态插入值.
function onRemoveOrEditButton() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const initialValue = sheet.getRange("A1").getValue();
var htmlOutput = HtmlService.createHtmlOutputFromFile('Dialog').setWidth(300);
htmlOutput.append('<script>var initialValue = ' + JSON.stringify(initialValue) + ';</script>');
SpreadsheetApp.getUi().showModalDialog(htmlOutput, ' ');
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link href="https://unpkg.com/@primer/css@^20.2.4/dist/primer.css" rel="stylesheet"/>
<style>
.form-control {
width: 200px;
}
</style>
</head>
<body>
<input class="form-control input-block" type="text" id="name" name="name" placeholder="name" style="width: 300px;" value= "<?= initialValue ?>"><br>
</body>
</html>