Skip to content
Advertisement

The Java Script Results not showing in HTML

I wrote a GAS code to check if the employee is In or Not in (extracting data from Google sheets). The console log give me the right answer but When I click on the button the answer doesn’t appear at the front end. Can you help me to troubleshoot on where I went wrong?

JavaScript

Advertisement

Answer

Google provides a very good Client-to-Server Communication guide that I highly suggest you read to get a better understanding of how this works.

You cannot put apps script code (e.g. SpreadsheetApp.getActiveSpreadsheet()) in your frontend scripts. That code has to be run by the apps script server in the backend and you’ll then call it using a google.script.run call.

Code.gs

JavaScript

Index.html

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement