我创建了一个侧边栏,用我的电子表格中的数据填充从“A”列到“G”列的列。但问题是我需要填充特定的列。我需要数据来开始填充从“E”到“J”的列和 1 个单独的列“L”。这些列用灰色着色。
如何指定这些列?
我的功能是:
function appendData(data){
var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Аркуш32");
ws.appendRow([data.product,data.clientname,data.partnername,data.adress,data.phone,data.email,data.source]);
}
我的 HTML 是:
<!DOCTYPE HTML>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="container">
<div class="row">
<div class="input-field col s12">
<i class="material-icons prefix">local_mall</i>
<input id="product" type="text" class="validate">
<label for="product">Товар</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">account_circle</i>
<input id="clientname" type="text" class="validate">
<label for="clientname">ПІП клієнта</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">assignment_ind</i>
<input id="partnername" type="text" class="validate">
<label for="partnername">Назва партнера</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">home</i>
<input id="adress" type="text" class="validate">
<label for="adress">Адреса</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">phone</i>
<input id="phone" type="text" class="validate">
<label for="phone">Номер телефону</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">mail</i>
<input id="email" type="text" class="validate">
<label for="email">Емейл</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix">hearing</i>
<input id="source" type="text" class="validate">
<label for="source">Джерело</label>
</div>
<div class="input-field col s12">
<button class="btn waves-effect waves-light" id="btn">Додати
<i class="material-icons right">send</i>
</button>
</div>
</div> <!-- end row -->
</div>
<!-- Compiled and minified JavaScript -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js">
</script>
<script>
var productBox = document.getElementById("product");
var clientnameBox = document.getElementById("clientname");
var partnernameBox = document.getElementById("partnername");
var adressBox = document.getElementById("adress");
var phoneBox = document.getElementById("phone");
var emailBox = document.getElementById("email");
var sourceBox = document.getElementById("source");
document.getElementById("btn").addEventListener("click",addRecord);
function addRecord(){
var data = {
product: productBox.value,
clientname: clientnameBox.value,
partnername: partnernameBox.value,
adress: adressBox.value,
phone: phoneBox.value,
email: emailBox.value,
source: sourceBox.value
};
google.script.run.appendData(data);
productBox.value = "";
clientnameBox.value = "";
partnernameBox.value = "";
adressBox.value = "";
phoneBox.value = "";
emailBox.value = "";
sourceBox.value = "";
}
</script>
</body>
</html>