title: copyInfo from one sheet to another sheet in google sheet with script
body: <p>I want to copy some data from sheet 1 to sheet 2, but every time I tried to run the below-attached code it send me an error which I mention in the comment.</p>
  <pre><code>function copyInfo() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var copySheet = ss.getSheetByName(&quot;Sheet 1&quot;);
    var pasteSheet = ss.getSheetByName(&quot;Sheet 2&quot;);
  
    // get source range
    var source = copySheet.getRange(2,1,38,17);
    // get destination range, &quot;TypeError: Cannot call method &quot;getRange&quot; of null.&quot;
    var destination = pasteSheet.getRange(pasteSheet.getLastRow()+1,1,38,17);
  
    // copy values to destination range
    source.copyTo(destination,{contentsOnly: true});
  }
  </code></pre>
  <p>Thanks in advance.</p>