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

292
Views
TypeError: data[j][0].setMilliseconds is not a function

I have an error message as below while executing the following code. The same code was running fine 2 days ago. Please would you be able to shed some light?

"Error TypeError: data[j][0].setMilliseconds is not a function assignEditUrls @ Code.gs:17"

function assignEditUrls() {
  var form = FormApp.openById('1PEopT9RzLFv-p5Esm1IXOF_-bzAnlsyzhAJ-qjWNBow');

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Form responses 1');

  var data = sheet.getDataRange().getValues();
  var urlCol = 237; 
  var responses = form.getResponses();
  var timestamps = [], urls = [], resultUrls = [];
  
  for (var i = 0; i < responses.length; i++) {
    timestamps.push(responses[i].getTimestamp().setMilliseconds(0));
    urls.push(responses[i].getEditResponseUrl());
  }
  for (var j = 1; j < data.length; j++) {

    resultUrls.push([data[j][0]?urls[timestamps.indexOf(data[j][0].setMilliseconds(0))]:'']);
  }
  sheet.getRange(2, urlCol, resultUrls.length).setValues(resultUrls);  
}
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!