title: Script to copy data from one google sheet to another based on a condition
body: <p>I have a google spreadsheet called the master list. It contains two sheets 'Response' and 'Master Response'. The response sheet has around 3000 rows of data and the first column in the 'response' sheet is called ' responded?'. I want to copy the row from 'response' sheet to ' master response' sheet if the 'responded?' column has the value 'called' in it and every time a new entry is made in the 'response' sheet the appropriate row of data should be copied to the 'master response' sheet. I am currently using the following code but the 'master response' is blank. I am new to using the google script editor and am not sure if the code is wrong or execution is not completed properly. Any help would be appreciated. Thank you</p>
  
  <pre><code>function onEdit() 
  {
  var sheetNameToWatch = "Response";
  var columnNumberToWatch = 1; 
  var valueToWatch = "Called"; 
  var sheetNameToMoveTheRowTo = "Master Response";
  
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  var range = sheet.getActiveCell();
  
  if (sheet.getName() == sheetNameToWatch &amp;&amp; range.getColumn() == 
  columnNumberToWatch &amp;&amp; range.getValue() == valueToWatch) {
  var targetSheet = ss.getSheetByName(sheetNameToMoveTheRowTo);
  var targetRange = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
  
  
  sheet.getRange(2, 1, sheet.getLastRow(), 
  sheet.getLastColumn()).moveTo(targetRange);
  }
  }
  </code></pre>