This script should append a new row to my spreadsheet 'onclick' of the button, however it doesn't. Ultimately I want to be able to add data to each textbox corresponding to a column and append a new row. Not sure why this doesn't work. How do I append a new row? THis script works in the script editor when I run it, just not in the sidebar html.
// Use this code for Google Docs, Forms, or new Sheets.
function onOpen() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.createMenu('SideBar')
.addItem('Open', 'openDialog')
.addToUi();
}
function openDialog() {
var html = HtmlService.createHtmlOutputFromFile("Index");
html.setTitle('Gmf Sent Msg Form');
SpreadsheetApp.getUi().showSidebar(html);
}
function insertRow(){
var doc = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1RY3TZvU- TFhlCyF9TKRk4Hb4b6Q1TnYa5K7ixyktykY/edit#gid=0");
doc.getActiveSheet().appendRow(['700','9/12/16','PO 16-45789'])
}
<body>
Use this form to enter information into the cells of the spreadsheet.<br>
<form>
<p>ID</p>
<input type="text" name="txtID" />
<p>Date</p>
<input type="text" name="txtDate"/>
<p>Subject</p>
<input type="text" name="txtSub" />
<input type="button" value="Append Row" onclick="google.script.run
.withSuccessHandler(insertRow)" />
</form>
</body>