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

217
Views
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 answers
Answer question

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 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!