I'm currently trying to write a form in HTML that passes its input to a spreadsheet. I did it as shown in the following video: https://www.youtube.com/watch?v=RRQvySxaCW0&list=PLv9Pf9aNgemt82hBENyneRyHnD-zORB3l. The problem is that the Logger in addInfo() function isn't working when the button is clicked (In the Logs is no "Hey" when the button got clicked).
My Code.gs (Google Apps Script) file:
function doGet(){
return HtmlService.createHtmlOutputFromFile("index");
}
function addInfo(){
Logger.log("Hey");
}
My index.html file:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<button id="btn">Klick mich</button>
<script>
document.getElementById("btn").addEventListener("click",doStuff);
function doStuff(){
google.script.run.addInfo();
}
</script>
</body>
</html>
Is anyone knowing why it is not working like that? I appreciate your help.
Best regards, Max
