Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

383
Vistas
¿Cómo establecer Formulas () en un rango usando Google Apps Script?

¿Qué debo cambiar para que este script establezca las fórmulas (desde la fila 2) al rango definido? El siguiente código no me da ningún error, pero no establece las fórmulas en absoluto.

 var lc = sheet.getLastColumn(); var range = sheet.getRange(2, 1, 1, lc); var formulas = range.getFormulas(); range.copyFormatToRange(sheet, 1, lc, 3, 3+response); //This pastes the format to the range, whose number of rows is defined depending on the # that the user inputs. var pasteTo = sheet.getRange(3, 1, response, lc);//Defines the range for setting formulas for (var a = 3; a < response; a++){ pasteTo = sheet.getRange("A" + a,sheet.getLastColumn()); pasteTo.setFormulas(formulas); } } }
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Hacer todo en Arrays es mucho más rápido

 function kdkdkd() { const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName('Sheet0'); const osh = ss.getSheetByName('Sheet1'); const fA = sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getFormulas(); osh.getRange(row,col,fA.length,fA[0].length).setFormulas(fA); }

elige lo que quieras para fila y columna

about 4 years ago · Juan Pablo Isaza Denunciar

0

Gracias, @TheMaster, por la orientación: la firma es .getRange('string') (a1notación) o .getRange(number,number) (fila, columna), pero no hay .getRange('string',number)

Así es como lo resolví:

 var lc = sheet.getLastColumn(); var range = sheet.getRange(2, 1, 1, lc); var formulas = range.getFormulas(); range.copyFormatToRange(sheet, 1, lc, 3, 3+response); var pasteTo = sheet.getRange(3, 1, response, lc); for (var a = 1; a <= response; a++){ pasteTo = sheet.getRange(a+2,1,1,lc); pasteTo.setFormulas(formulas); } } }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda