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

193
Views
How to get the Last updated item in Google sheets

I'm trying to find a solution online but it's not been fruitful so far, I want to fetch the data in Columns 1,2,3,4,5,6,7 that is last edited in Sheet1 and then feed it into Sheet2.

Giving you an example, If the data is edited in Sheet1 C2 that data should be added into Sheet2 in A2 and B2

What I'm trying to achieve is, if anyone updated Sheet one, I want to know the last update in Sheet 2, is it possible to do this via scrip?

Sheet1 Screenshot

enter image description here

Sheet2 Screenshot

enter image description here

I tried a lot of script editing and tried to modify it... so far nothing worked for me. :(

View Google Sheet

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In your situation, how about the following sample Script?

Sample script:

Please copy and paste the following script to the script editor of Spreadsheet and save the script. When you use this script, please edit "Sheet1". By this, the script is run by the simple trigger of OnEdit.

function onEdit(e) {
  const range = e.range;
  const sheet = range.getSheet();
  if (sheet.getSheetName() != "Sheet1" || range.rowStart == 1) return;
  const col = range.columnStart - 1;
  const [header, ...values] = sheet.getDataRange().getValues();
  const value = values[range.rowStart - 2];
  const v = [[`${value[0]} - ${value[1]}`, `${header[col]} - ${value[col]}`]];
  e.source.getSheetByName("Sheet2").getRange("A2:B2").setValues(v);
}
  • For example, when the cell "C2" of "Sheet1" is edited, AB0002 - Orange and Price - ### are put to the cells "A2:B2" of "Sheet2".

Note:

  • This script is run by the simple trigger of OnEdit. So, when you directly run the script with the script editor, an error occurs. Please be careful this. Please edit "Sheet1". By this, the script is run.

  • This sample script is for your sample Spreadsheet. When you changed the structure of the Spreadsheet and the actual Spreadsheet is different from your sample one, this script might not be able to be used. Please be careful about this.

Reference:

  • Simple Triggers
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!