Boa tarde,
Tenho um formulário no Google Sheets que abre em um Popup.
Gostaria que, quando eu salvar o cadastrado o Popup fecha-se.
Segue o código do Formulário.
Código
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class = "container">
<div class="row">
<div class="input-field col s12">
<i class="material-icons prefix">payment</i>
<input id="Nome" type="text" class="validate">
<label for="Nome">Forma de Pgto.</label>
</div>
<div class="input-field col s12">
<br>
<button class="btn waves-effect waves-light" id= "btn" >Salvar
<i class="material-icons right">add_box</i>
</button>
<button class="btn waves-effect waves-light red" id= "btn2" >Fechar
<i class="material-icons right">cancel</i>
</button>
</div>
</div>
</div>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
var CampoNome = document.getElementById("Nome");
document.getElementById("btn").addEventListener("click", Salvar);
function Salvar() {
var Nome = CampoNome.value;
if (Nome.trim().length == 0){
M.toast({html: 'Preencher todos os campos!'});
}else {
var Dados = {
Nome: CampoNome.value,
};
google.script.run.RegistrarFormaPgto (Dados);
CampoNome.value = "";
M.toast({html: 'Cadastro efetuado com sucesso!'});
}
}
document.getElementById("btn2").addEventListener("click", Fechar);
function Fechar() {
google.script.host.close();
}
</script>
</body>
</html>