Home Ask Login Register

Developers Planet

Your answer is one click away!

JLBJones February 2016

Invalid assignment left-hand side. (line 1, file "Code") - Google Apps Scripts

I've been coding less than a week, but I would think I would not have this much trouble trying to solve this error. Looked through other examples, but I am not likely knowledgeable enough to figure out how they apply to mine, 'cause none of them solved my problem. Here is the code:

function clearButtonClick() {
  var ss = SpreadsheetApp.getActive();
  var sheet = ss.getActiveSheet();
  Logger.log('sheet.getName(): ' + sheet.getName());
  if (sheet.getName() !== "TimeCardEntry") {return;};

function submitButtonClick(){
  //Begining of entry8 transfer
  var ss=SpreadsheetApp.getActive(); //Makes the active spreadsheet available for the program to act on
  var sheet = ss.getActiveSheet(); //Makes the active sheet available
  Logger.log('The active sheet is: ' + sheet.getName()); //Writes the sheet name to the log so it can be checked
  while(sheet.getName() =="TimeCardEntry"){  //If you are on the correct sheet when you try to run...
//change 8
    var cellB8 = sheet.getRange(8,2).getValue(); //Pulls in the value of "B8"
//change 8    
    if(cellB8 === "") {return}; //If B8 is not blank, or in other words, B8 has something in it, then...
      var targetSheet = ss.getSheetByName("TimesheetRecord"); //Pulls in the target sheet name
      var arrayOfData = []; //Creates the array to temporarily hold the data until it writes to target sheet
      var weekBegining = sheet.getRange(4,11).getValue(); //Stores the value of the "Sunday at the Begining of the Week Date"
      var employName = sheet.getRange(4,4).getValue();  //Stores the name of the employee from D4
//change 8      
      var entry8 = sheet.getRange(8,2,1,9);  //pulls in r        


Alex McMillan February 2016

You have a typo on the line:

Logger.log('Line 8 data is:' = entry8Data);

I think you mean:

Logger.log('Line 8 data is:' + entry8Data);

Also, best practice is to always use === to compare things, never == :)

Post Status

Asked in February 2016
Viewed 2,556 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life

Devs Planet ®

2014-2016 www.devsplanet.com

Devs Planet © all rights reserved