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

421
Views
La función getValue () no devuelve nada en Google Scripts for Sheets

Estoy tratando de usar los scripts de Google para seleccionar una fila aleatoria de las hojas de Google y devolver algunos de los valores de celda en esas filas para enviarme un correo electrónico.

Esto es lo que tengo hasta ahora:

 function sendEmails() { var ss = SpreadsheetApp.openById('x'); var sheet = ss.getSheetByName('report'); var numRows = sheet.getLastRow(); var randomRow = Math.floor(Math.random() * numRows); var bodyTitle = sheet.getRange(3, randomRow).getValue(); var bodyHighlight = sheet.getRange(4, randomRow).getValue(); var bodyLink = SpreadsheetApp.getActiveSheet().getRange(2, randomRow).getValue(); // var bodyTest = SpreadsheetApp.getActiveSheet().getRange(2, 2).getValue(); var body = bodyTitle + " | " + bodyLink + " | " + bodyHighlight ; var recipient = "x@gmail.com"; var subject = "resurfaced highlights"; MailApp.sendEmail(recipient, subject, body); }

Sin embargo, cuando recibo el correo electrónico, todo lo que aparece en el cuerpo es "| |" lo que hace que parezca que las funciones getValue() para las variables bodyTitle, bodyHighlight y bodyLink no funcionan. ¡Cualquier ayuda sería apreciada!

Gracias.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El problema está en el orden de los parámetros.

Se supone que es getRange(row, column) no getRange(column, row)

Simplemente cambie el orden de los parámetros.

Referencia:

  • getRange(fila, columna)
about 4 years ago · Santiago Trujillo 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!