title: Object does not allow properties to be added or changed - Google Apps Script
body: <p>I am building a Google script to interact with Drive and Sheets. When running the code below, I get an error upon executing </p>
  
  <p>"log.getActiveSheet().getRange(log.getLastRow(),2).setValue = date;"</p>
  
  <p>that states "Object does not allow properties to be added or changed." I can not figure out why. </p>
  
  <p>Does anyone have any insight?</p>
  
  <pre><code>function setUp() { 
    Logger.log("Starting setUp()");
    var user = Session.getActiveUser();
    var files = DriveApp.getFilesByName("ChangeAlert_Log");
    Logger.log(files.hasNext());
    var log;
    if(files.hasNext() == false){
      Logger.log("creating log file now...");
      log = SpreadsheetApp.create("ChangeAlert_Log");
      log.getActiveSheet().getRange(1, 1).setValue("file_names");
      log.getActiveSheet().getRange(1, 2).setValue("file_dates");
      return log;
    } else{
      Logger.log("Found Log...trying to open");
      var logFile = files.next();
      var url = logFile.getUrl()
      log = SpreadsheetApp.openByUrl(url);
      log.addEditor(user);
      Logger.log("returning setUp()");
      return log;
    }
  }
  
  function IDfiles(){
    Logger.log("running IDfiles()");  
    var log = setUp()
    var user = Session.getActiveUser();
    var user_files = DriveApp.getFiles(); //returns a FileIterator Object
    var i = 0;
    var file;
  
    while(user_files.hasNext()){
      file = user_files.next();
      if(file.isStarred()){
        var date = file.getLastUpdated();
        Logger.log("Date: " + date);
        //file_dates[i] = date;
        log.getActiveSheet().getRange(log.getLastRow(),2).setValue = date;
        var fileName = file.getName();
        Logger.log("File: " + fileName);
        log.getActiveSheet().getRange(log.getLastRow(), 1).setValue = fileName;
        //file_names[i] = fileName;
        i++;
        Logger.log("i= " + i);
      }
    }  
  
    Logger.log("returning IDfiles()");
    return;
  </code></pre>