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
OnEdit function with google Spreadsheet

I am still a newbie in this, but I want to run Onedit function script on google spreadsheet in a way that I will only get value on column E if the value on column D is "completed" and at the same time I will get value on column F depending on the value on B1 ( and that's only if the column D is"completed"). here is my spreadsheet: https://docs.google.com/spreadsheets/d/1-xLH3mb0fGngocOleCNExEmP6FnDMEFg2uLFXC10XEk/edit#gid=0

function onEdit(e){
    var s = SpreadsheetApp.getActiveSpreadsheet();
    if( s.getName() == "Hub" ){ 
    var r = s.getActiveCell(); 
    if (r.getColumn() == 4) {
    var timecell = r.offSet(0, 1);
    var assldapv = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Hub").getRange("B1").getValue(); 
    var assldapo = r.offset(0, 2);   
    if ( r.getValue() === 'completed' ) {
    timecell.setValue(new Date());
    assldapo.setValue(assldapv); }

However this function is not working, so can you please give me a template on how to proceed with such script.

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

0

Try this

function onEdit(e) {
  var sh = e.range.getSheet();
  if (sh.getName() == "Hub" && e.range.columnStart == 4 && e.value == "completed") {
    var timecell = e.range.offSet(0, 1);
    var assldapv = sh.getRange("B1").getValue();
    var assldapo = e.range.offset(0, 2);
    timecell.setValue(new Date());
    assldapo.setValue(assldapv);
  }
}
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!