0
我要做的就是讓我的側邊欄處理用戶條目,並將它們輸入到工作表中的指定範圍中。這是我的代碼到目前爲止:Google表格/腳本:在工作表中回覆(HTML側欄)
function onOpen(e) {
var html = HtmlService.createHtmlOutput()
.setTitle('TITLE')
.setContent('<label>Enter Search Term: </label> <br /><input id="WCB#" name="WCB#" type="text" /><br /><label>Enter Start Date: </label> <br /><input id="WCB#" name="WCB#" type="text" /><br /><label>Enter End Date: </label> <br /><input id="WCB#" name="WCB#" type="text" /><br /><input type="button" value="Submit" google.script.run.withSuccessHandler(onSuccess) />');
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showSidebar(html);
}
提交按鈕應該有一個'的onClick =「google.script.run.withSuccessHandler(的onSuccess).nameofScriptFunction()」;'你需要添加的onClick和你的谷歌腳本函數的名稱。 – Cooper
非常感謝。請原諒我的無知。但是,如何告訴我的函數將數據從側邊欄窗體中拉出並將其輸入到表單中的指定範圍內?我似乎無法找到指示。謝謝。 –
您可能需要更改文本框的ID,以便您可以使用document.getElementById().value或$('#id)).val()從文本框中獲取值。 'd可能會將它們以數組的形式返回給.gs文件中的腳本。這裏是一個[完整示例]的鏈接(https://stackoverflow.com/questions/44601310/how-to-send-data-from- html-form-to-google-spreadsheet-using-javascript/44607932#44607932)。它不是一個側邊欄,但它可能是。如果你不介意,我會很感激,如果你要檢查我的答案。謝謝 – Cooper