title: How do you copy a range and paste only rows with values into another sheet?
body: <p>Let me preface this by saying I realize the simple solution is to filter the column/uncheck blanks, copy, and paste values into the new column. The problem is that with teachers who aren't "tech savvy", nothing is simple.</p>
  
  <p>With that said, I'm pulling data from multiple sheets in the same google spreadsheet into the "Master" sheet. I have a custom menu item called "Visibility" to hide/show the empty rows. After the rows are hidden, the teacher clicks the "Copy Data" button to copy A1:A to another sheet called "Copy". This is where I run into the problem - when the data is copied to the "Copy" sheet the empty rows are too. I just want the rows with values copied over.</p>
  
  <p>Here's the script I'm using to copy the values from Master to Copy: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/**
   * A function named onEdit will be called whenever
   * a change is made to the spreadsheet.
   * 
   * @param  {object} e The edit event (not used in this case)
   */
  function copyRange(e){
    var copyFromRange = 'Master!A1:A'; // no row for second cell reference
    var copyToRangeStart = 'Copy!A1';
    copyValuesOnly(copyFromRange, copyToRangeStart);
  }
  
  /**
   * This function will copy the values from a given range to
   * a second range, which starts from the given cell reference
   * 
   * @param  {string} copyFromRange    Range reference eg: 
   * @param  {string} copyToRangeStart Cell reference eg:
   */
  function copyValuesOnly(copyFromRange, copyToRangeStart) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var source = ss.getRange(copyFromRange);
    source.copyTo(ss.getRange(copyToRangeStart), {contentsOnly: true});
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Also, I edited a script I found to get what I'm working with so disregard the descriptions in my code. Thank you for any help you can provide!</p>