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

109
Views
Guión de la aplicación creteTextFinder de búsqueda múltiple

Actualmente estoy trabajando en un proyecto en el que envío datos a una hoja de Google a través del script de la aplicación. Necesito cambiar el valor de algunos datos y usé createTextFinder . Gracias a @Mimi en este hilo. Pero el hecho es que necesito reemplazar más de un texto. Necesito cambiar el texto cuando se agregan los datos. gracias de antemano

Aquí está mi código

 function addUser(sheet) { var FILE = SpreadsheetApp.openById("XXXXXXXXXXXXX"); var sheet = FILE.getSheetByName("Sheet1"); var id = "True"; var name = "FALSE"; var t1 = createTextFinder("TRUE").replaceAllWith("YES") var t2 = createTextFinder("FALSE").replaceAllWith("NO") sheet.appendRow([id,name]).t1.t2;
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Desde I need to change the text when the data is appending. , en este caso, ¿qué tal la siguiente modificación?

De:

 var t1 = createTextFinder("TRUE").replaceAllWith("YES") var t2 = createTextFinder("FALSE").replaceAllWith("NO") sheet.appendRow([id,name]).t1.t2;

A:

 var values = [id, name].map(e => { var temp = e.toUpperCase(); return temp == "TRUE" ? "YES" : temp == "FALSE" ? "NO" : e; }); sheet.appendRow(values);
  • Por ejemplo, cuando deba usar TextFinder, ¿qué tal la siguiente modificación?

    • De

       var t1 = createTextFinder("TRUE").replaceAllWith("YES") var t2 = createTextFinder("FALSE").replaceAllWith("NO") sheet.appendRow([id,name]).t1.t2;
    • A

       sheet.appendRow([id, name]); sheet.createTextFinder("TRUE").replaceAllWith("YES"); sheet.createTextFinder("FALSE").replaceAllWith("NO");
    • o, cuando desee usar TextFinder en la fila adjunta, también puede usar el siguiente script modificado.

       sheet.appendRow([id, name]); // SpreadsheetApp.flush(); // This might be not required to be used. const range = sheet.getRange(sheet.getLastRow(), 1, 1, 2); range.createTextFinder("TRUE").replaceAllWith("YES"); range.createTextFinder("FALSE").replaceAllWith("NO");
about 4 years ago · Juan Pablo Isaza Report

0

Reemplazo múltiple

 function addUser() { const txtA = ['txt1', 'txt2', 'text3']; const rplA = ['rpl1', 'rpl2', 'repl3']; var ss = SpreadsheetApp.openById("XXXXXXXXXXXXX"); var sh = ss.getSheetByName("Sheet1"); txtA.forEach((t, i) => { let f = sh.createTextFinder(t).findAll(); if (f) { f.forEach(r => { r.setValue(r.getValue().replace(txtA[i], rplA[i])); }); } }); }
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!