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

134
Vistas
For Loop in Google Macro

I'm trying to run a macro loop that copies and input, pastes it into another cell on the same sheet and then pastes the output into a cell directly next to the input. I would like the loop to continue for 135ish rows with inputs and outputs just continually getting copied and pasted. Below is what I have so far, but when I try to run it all I get is "spreadsheet.getRange is not a function"

Update: Ive added (). to the first line and now I get a "Range not found" error

function SameSheet() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet;
  for(var i = 1; i <= 132; i++ ) {
    var Team = spreadsheet.getRange(i, 1).getValue();
    var Output = spreadsheet.getRange ( i, 2)
    spreadsheet.getRange('F1').activate();
    spreadsheet.getRange(Team).copyTo(spreadsheet.getActiveRange(), 
    SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
    spreadsheet.getRange(Output).activate();
    spreadsheet.getRange('H36:J36').copyTo(spreadsheet.getActiveRange(), 
    SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);

  }};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

function SameSheet() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet;
  const vs = sh.getRange(1, 1, 132).getValues().forEach((r, i) => {
    let team = r[0];//getting same value from array is much faster
    let output = r[1];//same here
    sh.getRange(team).copyTo(sh.getRange('F1'), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
    sh.getRange('H36:J36').copyTo(sh.getRange(output), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
  });
}
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