New Google Sites – Embed HTML, Javascript and Google Spreadsheets


I'm trying to use the object "Embed" from the new Google Sites I select the option "Embed Code" and put the code below and when executed the following error message appears: "ReferenceError: SpreadsheetApp is not defined" Does anyone know of any alternative that will solve this problem ?? Thanks

   function funcaoLogar(){
      var planilha = SpreadsheetApp.openById('1y-hmm2qSJGzZ1M8kHD-ZF-....');
      var pasta = planilha.getSheetByName("DADOS");

      var pLogin = pasta.getRange(1, 1).getValue();
      var pSenha = pasta.getRange(2, 1).getValue();
     } catch (erro) {
          document.getElementById('texto').innerHTML = erro;

     var login = document.getElementById('fLogin').value;
     var senha = document.getElementById('fSenha').value;

     if(login == pLoguin && senha == pSenha){'';  
        }else {document.getElementById('texto').innerHTML = "Login ou Senha errada";} 

 <p>Login: <input id="fLogin" type="text" value="">
 <p>Senha: <input type="password" id="fSenha" type="text" value="">
 <p><button type="button" onclick="funcaoLogar()">Logar</button>
 <p id="texto">


Trying to simplify the problem in Google App Script I created the file with the code below:

function doGet() {
  return HtmlService.createHtmlOutputFromFile('arquivoHTML');

function mostrarTexto(){
    //escreva aqui o seu código Google Script;
    return "Deu certo!!!!";

I created the HTML.html file with the code below

<!DOCTYPE html>
      function funcaoScript(){

                document.getElementById('resultado').innerHTML = retornoFuncao;
    <button onclick="funcaoScript()">Mostrar Resultado</button>
    <p id="resultado"></p>

I activated the API: Google Classroom API

when I tested using the Publish >> Deploy as web application menu… it worked. But when I tried to embed in google sites it appeared "undefined"

I also tried to embed the html code on google sites itself and nothing happened.

Maybe it's a light for the solution to the problem.

Scroll to Top