Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
Problema con la secuencia de comandos de la hoja de Google

Estoy tratando de replicar una hoja de cálculo que vi en línea con modificaciones. El propósito de la hoja de cálculo es documentar mis diferenciales de crédito Bull Put/Bear Call. El plan es tener una hoja de tablero donde pueda ingresar la información y al hacer clic en el botón Agregar posición, transferirá la información a la hoja de datos donde se guardarán todos los registros. También podré cerrar posiciones desde la página del tablero, pero aún no he comenzado ese script. El guión que estoy armando es.

 function AddPosition() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var dashboard = ss.getSheetByName("Dashboard"); var data = ss.getSheetByName("Data"); var expiration = dashboard.getRange(7, 3).getValue(); var sym = dashboard.getRange(7, 4).getValue(); var contracts = dashboard.getRange(7, 5).getValue(); var type = dashboard.getRange(7, 6).getValue(); var shortleg = dashboard.getRange(7, 7).getValue(); var longleg = dashboard.getRange(7, 8).getValue(); var pop = dashboard.getRange(7, 9).getValue(); var credit = dashboard.getRange(7, 10).getValue(); if (expiration=="" || sym=="" || contracts=="" || type=="" || shortleg=="" || longleg=="" || pop=="" || credit=="" || { **var ui = SpreadsheetApp.getUi(); // Same variations.** var response = ui.alert('Missing data','Please fill in missing values and try again.', ui.ButtonSet.OK); return; } data.insertRowAfter(data.getLastRow()); var lastRow = data.getLastRow(); var now = new Date(); data.getRange(lastRow, 1).setValue(now); data.getRange(lastRow, 2).setValue(sym); data.getRange(lastRow, 3).setValue(type); data.getRange(lastRow, 4).setValue(expiration); data.getRange(lastRow, 6).setValue(longleg); data.getRange(lastRow, 7).setValue(shortleg); data.getRange(lastRow, 9).setValue(contracts); data.getRange(lastRow, 10).setValue(credit); data.getRange(lastRow, 13).setValue(pop); data.getRange(lastRow-1, 33).copyTo(data.getRange(lastRow, 33)); data.getRange(lastRow-1, 34).copyTo(data.getRange(lastRow, 34)); data.getRange(lastRow-1, 35).copyTo(data.getRange(lastRow, 35)); data.getRange(lastRow-1, 36).copyTo(data.getRange(lastRow, 36)); data.getRange(lastRow-1, 37).copyTo(data.getRange(lastRow, 37)); dashboard.getRange(7,2,1,11 ).clearContent(); }

En la línea 23 var ui = SpreadsheetApp.getUi(); // Mismas variaciones. sigo recibiendo

Error de sintaxis: línea de identificador inesperado: archivo 23: Código Gs

No sé qué estoy haciendo mal.

Básicamente, estoy tratando de decir que si faltan datos, se activará una alerta que dice "'Datos faltantes', 'Complete los valores faltantes e intente nuevamente'".

¿Alguien puede ayudar?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Vi algunos paréntesis faltantes dentro de su declaración if-else y también algunos asteriscos "*" en la var declarada. Lo arreglé y se ejecutó correctamente en mi extremo.

Prueba esto:

 if (expiration=="" || sym=="" || contracts=="" || type=="" || shortleg=="" || longleg=="" || pop=="" || credit=="") { var ui = SpreadsheetApp.getUi(); //Same variations. var response = ui.alert('Missing data','Please fill in missing values and try again.', ui.ButtonSet.OK); return; }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda