title: how can I copy data validations from one spreadsheet to another using google script
body: <p>I am trying to write script that will get a cell that has Data validation from a control spreadsheet and add it to a location (same) in another spreadsheet.</p>
  
  <p>I am using:</p>
  
  <pre><code>  var myCell = SpreadsheetApp.getActive().getRange('D4');
    var rule = myCell.getDataValidation();
  </code></pre>
  
  <p>but apparently the spreadsheet is not active during the script process so the rule is null.</p>