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

107
Vistas
paste on top of the row instead of the bottom row

at the moment I have a sheet that has a script that is time triggered, the script at the end of the day will copy sheets at the bottom of the target sheet, everytime I am trying to do targetSheet.getrange(1,1) + 1; it's not converting range to int. can someone please help?

   function copyData() {
  
  var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var sourceSheet = spreadSheet.getSheetByName('copiedPausingSheet');

  let sourceRange = sourceSheet.getDataRange();
  let sourceValues = sourceRange.getValues();


  let rowCount = sourceValues.length;
  let columnCount = sourceValues[0].length;

  let targetSheet = spreadSheet.getSheetByName('collectivePausingData');
  let lastrowCount = targetSheet.getLastRow() + 1;
  
  let targetRange = targetSheet.getRange(lastrowCount,1, rowCount,columnCount);

  targetRange.setValues(sourceValues);
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Is that what you mean? Paste values on the top of the sheet.

function copyData() {
  
  var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var sourceSheet = spreadSheet.getSheetByName('copiedPausingSheet');

  let sourceRange = sourceSheet.getDataRange();
  let sourceValues = sourceRange.getValues();


  let rowCount = sourceValues.length;
  let columnCount = sourceValues[0].length;

  let targetSheet = spreadSheet.getSheetByName('collectivePausingData');
  targetSheet.insertRows(1,sourceValues.length);
  
  let targetRange = targetSheet.getRange(1,1,sourceValues.length,sourceValues[0].length);

  targetRange.setValues(sourceValues);
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Do you mean this?

function copyDataOnTop() {

  var spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
  var sourceSheet = spreadSheet.getSheetByName('copiedPausingSheet');

  let sourceRange = sourceSheet.getDataRange();
  let sourceValues = sourceRange.getValues();

  let targetSheet = spreadSheet.getSheetByName('collectivePausingData');
  var targetValues = targetSheet.getDataRange().getValues();

  var allValues = [...sourceValues, ...targetValues];
  
  let targetRange = targetSheet.getRange(1,1,allValues.length,allValues[0].length);
  targetRange.setValues(allValues);
}
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