20 days ago

What is the solution to this error when working with AppScript?

Can someone assist me with my code? I am working on an app script that validates certain IDs with Google Sheets. I am following this tutorial (, and I have followed all the steps. However, I am getting an error that says, "SyntaxError: Unexpected token '=' (line 4, file "Code")". I have watched the video again, and the code is the same. I am unsure what the issue could be.

function doGet() {
  var template = HtmlService.createTemplateFromFile('index');
  var html = template.evaluate();
  return html;

function include(fileName) {
  return HtmlService.createHtmlOutputFromFile(fileName).getContent();

function verificarPassword(form) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheetUsuarios = ss.getSheetByName('Usuarios');
  var datausuarios = sheetUsuarios.getUsuarios.getDataRange().getValues();
  var sheetVentas = ss.getSheetByName('Ventas');
  var dataVentas = sheetVentas.getDataRange().getDisplayValue();
  for (var i in datausuarios) {
    if (dataUsuarios[i][1] == form.usuario && dataUsuarios[i][2] == form.contrasena) {
      var usuario = {
        headers: dataVentas[0],
        nombre: dataUsuarios[i][0],
        ventas: ''
      for (var fila in dataVentas) {
        if (dataVentas[fila][0] == usuario.nombre) {
          usuario.ventas = dataVentas[fila];
        return usuario;
    throw ('La contrasñea es incorrecta');
I would deeply appreciate urgent assistance.

19 days ago
Verified Answer
I'm sorry to hear that you're having trouble with your code. The error message "SyntaxError: Unexpected token '=' (line 4, file "Code")" usually means that there is an unexpected token in the code. In this case, it seems that the issue is with the use of "&&" instead of "&&" in line 12. Try changing "&&" to "&&" and see if that resolves the issue. If you still have issues, please let me know. I hope this helps! Let me know if you have any other questions.


SyntaxError: Unexpected token - JavaScript | MDN - Mozilla DeveloperHow to fix `SyntaxError: Invalid or unexpected token` when trying to ...SyntaxError: missing ; before statement - JavaScript | MDN
20 days ago
It seems like there is a syntax error on line 19, where you have written datausuarios instead of dataUsuarios (capital U). This error is causing issues with the rest of your code. Try correcting this and see if it works. Also, make sure that you have defined the getUsuarios method for sheetUsuarios in your code.