I have run into a small issue with this script, it does copy the values in the range but pastes them under the 1500 cell in column A on the destination Sheet. I can't seem to get it to paste to the next free cell in Col A.

function EndShift() 
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  var source = ss.getSheetByName('Logbook');
  var dataToCopy = source.getRange('A7:F40');
  var dataToClear = source.getRange('C7:F40');
  var copyToSheet = ss.getSheetByName('Log Sheet');
  var sourceValues = dataToCopy.getValues();
  var lastRowUsed = copyToSheet.getRange(1,1);
  var lastRow = lastRowUsed.getLastRow();

  copyToSheet.getRange(lastRow + 1, 1, sourceValues.length, 6).setValues(sourceValues);



It's very likely that you spreadsheet has formulas that are returning an empty text or something similar. Review your spreadsheet carefully and adjust the formulas accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.