title: How to move a row from one google spreadsheet to another based on a value in a cell?
body: <p>My script is supposed to move a row from one google spreadsheet to another based on a value in a cell. It fails to do so, and I think it's because of the onEdit() function but can't figure it out. I found a solution for different sheets in the same spreadsheet but not in different spreadsheets. My code is below.</p>
  
  <pre><code>function onEdit(e) {
  
    var sss = SpreadsheetApp.getActiveSpreadsheet();
    var ss = e.source.getActiveSheet();
    var r = e.source.getActiveRange();
    if(s.getName() == "source_sheet" &amp;&amp; r.getColumn() == 7 &amp;&amp; r.getValue() == "Pavlovo"){
  
    //Get full range of data
    var SRange = ss.getRange(1, 3, 1, 5);
    //get A1 notation identifying the range
    var A1Range = SRange.getA1Notation();
    //get the data values in range
    var SData = SRange.getValues();
  
    // tss = target spreadsheet 
    var tss =  SpreadsheetApp.openById('1_t7BDCWgHJDip_cndzVashxLDQ_pVS6obi3I9TB_EJI'); 
  
    var ts = tss.getSheetByName('Vitosha'); // ts = target sheet
    //set the target range to the values of the source data
    ts.getRange(A1Range).setValues(SData);
    }
  
  }  
  </code></pre>