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

238
Views
Google Sheet/Apps script/Activar cuando se agrega una nueva fila

Actualmente estoy trabajando en un script de aplicaciones en un archivo de hoja de Google. Hice un script que envía correo a los contactos. En mi hoja, los contactos tienen la forma de una línea que se agrega automáticamente con un zapier. He instalado un disparador onChange pero me gustaría que actúe solo cuando se agrega una nueva fila a mi hoja, he buscado en todas partes pero ninguna solución funciona o corresponde a mi problema. Entonces, si alguien tiene una idea para resolverlo, sería útil (le dejo una copia de mi script a continuación) gracias de antemano '

 function envoie_mail (){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet1=ss.getSheetByName('testmail'); var lr = sheet1.getLastRow(); var eligible = sheet1.getRange(lr,4).getValue(); var emailadresse = sheet1.getRange(lr,1).getValue(); var subject = sheet1.getRange(lr,2).getValue(); if (eligible === "non"){ var htmlTemplate = HtmlService.createTemplateFromFile("body.html"); var modele = htmlTemplate.evaluate().getContent(); var reference = sheet1.getRange(lr,3).getValue(); modele = modele.replace("<ref>",reference).replace("<ref2>",reference); MailApp.sendEmail({ to: emailadresse, subject: subject, htmlBody: modele }); } }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No sé cómo funciona zapier, sin embargo, intente poner un indicador y pruebe de la siguiente manera

 function createSpreadsheetChangeTrigger() { var ss = SpreadsheetApp.getActive(); ScriptApp.newTrigger('onChange') .forSpreadsheet(ss) .onChange() .create(); } function onChange(e) { var f = SpreadsheetApp.getActiveSheet() var data = f.getRange(1,f.getLastColumn(),f.getLastRow(),1).getValues().join().split(',') for (var i=0;i<data.length;i++){ if (data[i]=='') { Browser.msgBox('envoi mail ligne ' + (i+1)) f.getRange((i+1),f.getLastColumn()).setValue('ok') } } }

https://docs.google.com/spreadsheets/d/1TEWS1e3uOnYybgbuScWb9plA9J7rgVjt16g9Ucg0x3M/copia

ingrese la descripción de la imagen aquí

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!