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

139
Views
¿Cómo puedo hacer que mi secuencia de comandos se ejecute en varias hojas en Google Sheets? Estoy insertando filas con datos y necesito que se ejecute en varias hojas

Estoy escribiendo un script que inserta una fila debajo de la fila 1 de cada hoja e incluye algunos datos en esa fila. Funciona para la primera hoja, pero necesito que funcione para varias hojas. Cada hoja es el nombre de un gerente comercial (Brian, por ejemplo), y sería útil ejecutar esto para todas las hojas. He probado varios métodos de preguntas similares anteriores pero no he conseguido que nada funcione. El código está debajo.

 function myFunction() { var ss=SpreadsheetApp.getActiveSpreadsheet(); var dataSht = ss.getSheetByName("Brian"); var lastRow = dataSht.insertRows(2,1) var dataRng = dataSht.getRange("A2:D2").getValues(); dataSht.getRange("A2:B2").setFormula('=A3:B3') }
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Si no desea utilizar todas las hojas

 function myFunction() { const ss = SpreadsheetApp.getActive(); const incl = ["Brian", "others"] ss.getSheets().filter(s => ~incl.indexOf(s.getName())).forEach(sh => { sh.insertRows(2, 1) sh.getRange("A2:B2").setFormula('=A3:B3') }) }
about 4 years ago · Santiago Trujillo Report

0

Probar

 function myFunction() { var ss=SpreadsheetApp.getActiveSpreadsheet(); ss.getSheets().forEach(function(dataSht){ dataSht.insertRows(2,1) dataSht.getRange("A2:B2").setFormula('=A3:B3') }) }
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!