0

I have looked at other posts and am struggling with the same issue of how to pass form values to GAS. Since GUI editor has been depreciated, I decided to go the htmlservice form route. In this simple code below, I'm just trying to access the form field aField and paste it in a cell.

function doGet() {

return HtmlService.createHtmlOutputFromFile('myForm.html');
}  

function processForm(value) {
  
var myRange = SpreadsheetApp.openById("xxx").getSheetByName("Results-List").getDataRange("B20");    
myRange.setValue(value.aField);

 }

This is the HTML template myForm.html:

 <html>

 <form id="myForm">
 <input name="aField" id="aField">
 <input type="button" id="submit" value="submit" onclick = "sendData()">
 </form>

 <script>
   function sendData() {
    google.script.run.processForm(document.getElementById("myForm"));
}

 </script>
 </html>

1 Answer 1

1

.getDataRange() has a different use. Use .getRange('B20') to get this to work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.