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

216
Vistas
How to search for yesterday's date in a row, then copy / paste values to new Google Sheet

I have a Google Sheet (let's call it Sheet A) with Date, Sku ID and Copy ID columns (among others). I would like to write a bit of JavaScript in Apps Script that will search the Date column of Sheet A for yesterday's date, then copy that cell, plus the Sku ID and Copy ID from that row into another sheet (Sheet B).

I already have a function that adds new rows to Sheet B, I just need to copy the data from yesterday into those new rows.

Right now my thought process is:

  • Get yesterday's date and set it as a variable
  • Set source variable as a range from Sheet A (Date column, which is column A)
  • Search that source for yesterday's date
  • Copy date value, Sku ID and Copy ID
  • Paste to Sheet B

Am I on the right track? Any pointers on how to actually write that? Am I over complicating/simplifying?

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

0

Finding yesterdays rows

function lfunko() {
  const ss = SpreadsheetApp.getActive();
  const sr = 2;//data start row
  const sh = ss.getActiveSheet();
  const[hA,...vs] = sh.getDataRange().getValues();//assume one header
  const ydv = new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1).valueOf();
  vs.foEach((r,i) => {
    let dt = new Date(r[0]);
    let dtv = new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()).valueOf();
    if(ydv == dtv) {
      //this is one of yesterdays rows
      //row is i + sr
    }
  })
}
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