Double the variables in move script (Google)

For my work I am trying to automatically move a marked line to a 'Historie' sheet. I have currently managed to follow an example and use 1 variable (see copy). Now I want 2 variables. Instead of just column K -> Completed, I also want to add that column J needs to be True!

function onEdit(event){
  var url = "";
  var source_sheet_name = "Werklijst";
  var target_sheet_name = "Historie";
  var columnLetter = "J";
  var ss= SpreadsheetApp.openByUrl(url);
  var source_sheet = ss.getSheetByName(source_sheet_name);
  var target_sheet = ss.getSheetByName(target_sheet_name);
  var source_range = source_sheet.getRange(columnLetter+":"+columnLetter).getValues();
  for(var i = source_range.length-1; i >= 0;i--){
      var targetRange = target_sheet.getRange(target_sheet.getLastRow() + 1, 1);
      source_sheet.getRange((i+1), 1, 1, source_sheet.getLastColumn()).moveTo(targetRange);

Here is the link to a copy of said sheet (it is in Dutch).

Read more here:

Content Attribution

This content was originally published by Thomas Rooyakkers at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: