Technologies:
Tolerim
20 days ago
What is the solution to this error when working with AppScript?
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];
break;
}
return usuario;
}
}
throw ('La contrasñea es incorrecta');
}
}
Answers(2)
Vogi
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.
Sources
SyntaxError: Unexpected token - JavaScript | MDN - Mozilla DeveloperHow to fix `SyntaxError: Invalid or unexpected token` when trying to ...SyntaxError: missing ; before statement - JavaScript | MDNTolerim
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.