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

167
Views
Onchange AppScript - Create History Of Changes For Specific Column

I have a sheet that gets updated through ImportRange. There is a column in that sheet that represents the performance of the customer. It can either be performing or underperforming based on a data set that exists in our CRM.

Customer Name Performance Status
Customer1 performing
Customer2 underperforming

These statuses change throughout the week I'm trying to run a script that logs all these changes per customer, and ideally, notifies me when the status changes to underperforming.

  1. Since it's ImportRange, I've been using the onChange trigger.
  2. To store & retrieve the old values, I'm using the PropertiesService
  3. Haven't figured out how to compare these two datasets to trigger a notification.

Here's what I have so far:

  1. Trigger function:

function performance(e) {

Logger.log (e.changeType);
// if (e.changeType =="OTHER") return;
let props = PropertiesService.getScriptProperties().getProperties();
const sh = SpreadsheetApp.getActive();
const ss = sh.getSheetByName("sheetname");

for (let p in props) {
  
  let r = ss.getRange(p);
  let val = r.getValue();

  // if(val != props[p]){
    // r.offset(1,0).setValue(props[p]);
    Logger.log(PropertiesService.getScriptProperties().setProperty("data",ss.getRange("A7:N").getValues()));
  // }
}

Regarding the set_properties, it returns this format. Not sure how to access those values and how to compare them with the previous values.

function set_properties(){

  
const sh = SpreadsheetApp.getActive();
const ss = sh.getSheetByName("sheetname");
var range = ss.getRange("A7:N");
var values = range.getValues();

// This logs the spreadsheet in CSV format with a trailing comma
for (var i = 0; i < values.length; i++) {
  var row = "";
  for (var j = 0; j < values[i].length; j++) {
    if (values[i][j]) {
      row = row + values[i][j];
    }
    row = row + ",";
  }
  Logger.log(row);
 
}

PropertiesService.getScriptProperties().setProperty('data',row);

}
about 4 years ago · Juan Pablo Isaza
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!