Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!