I have created script with add information into several sheets. But it don't work when I want add information in only one sheet. What should I change in this script? This is link to my previous topic: enter link description here
<b>test 1.1</b><br />
<br>
<form>
<br>
Nr item:<br>
<input id="NrItem" name="NrItem" type="text" />
<br>
<br>
<input name="choices" type="checkbox" value="Sheet1" /> sheet1
<br>
<br>
<input name="choices" type="checkbox" value="Sheet2" /> sheet2
<br>
<br>
<input name="choices" type="checkbox" value="Sheet3" /> sheet3
<br>
<br>
<br>
<input onclick="formSubmit()" type="button" value="Add Row" />
<input onclick="google.script.host.close()" type="button" value="Exit" />
</form>
<script type="text/javascript">
function formSubmit() {
google.script.run.getValuesFromForm(document.forms[0]);
}
</script>
function demoHtmlServices() {
var ss = SpreadsheetApp.getActiveSpreadsheet(),
html = HtmlService.createHtmlOutputFromFile('Index').setWidth(200).setHeight(550);
ss.show(html);
}
function getValuesFromForm(form){
var NrItem = form.NrItem,
date = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd");
sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
for (var i in sheets) {
for (var j in form.choices) {
if (form.choices[j] == sheets[i].getName()) {
sheets[i].appendRow([date, NrItem]);
}
}
}
}
And I have another question to this, how can I send email with information insert in form? When I have information about "Nr item" and "sheets numbers" I want send email about information "Nr item" and in with sheet information will be insert.
Regards