title: Delete blank rows in spreadsheet using Google script
body: <p>Spreadsheet-1: Data present in Spreadsheet-1,</p>
  
  <pre><code>Name     apple  android   windows    linux
  Germany    3      4         6          7
  America    4      1         6          2
  Sweden     1      6         1          6
  Paris      5      0         2          4
  </code></pre>
  
  <p>Spreadsheet-2: Data present in Spreadsheet-2,</p>
  
  <pre><code>Date   Name    apple  android   windows    linux
  </code></pre>
  
  <p>I am able to copy the data from spreadsheet1 to spreadsheet2 by using the below google script.</p>
  
  <pre><code>function Daily() {
    var SpreadSheetKeyA = "mykey1";
    var SpreadSheetKeyB = "mykey2";
    var sheet1 = SpreadsheetApp.openById(SpreadSheetKeyA).getSheetByName("Showstopper");
    var sheet2 = SpreadsheetApp.openById(SpreadSheetKeyB).getSheetByName("Daily");
    var data = sheet1.getRange(5,11,40,6).getValues();
    var time = new Date ().toJSON().slice(0,10);;
    for (var r = 0; r &lt; data.length; r++) {
      data[r].unshift(time);
      sheet2.appendRow(data[r]);
      }
  }
  </code></pre>
  
  <p>The data present in spreadsheet1 is dynamic i.e, the number of rows can vary. Now whenever I run the script again so as to update the spreadsheet2 data is being appended after blank rows. I would like enhance the above script so that it should avoid blank rows or only copy rows with data.</p>
  
  <p>Can anyone help me with this please </p>