How to use the getRange() method with an array value as one of the parameters
<p>I don't have much experience using Javascript but I'm developing a simple code to filter some information relevant to a professor I'm helping. I am searching the row number of a certain amount of data using a for and then I'm using an array to store all the rows that contain those words. Since I'm using Appscript, I only need to relocate a certain amount of data from the row I'm returning to a final row I've already know. My code is as follows: </p>

<pre><code> if(cell === "Average")
{
   index++;
   initialcoords[index] = n; // n is the iteration variable in the for
}
</code></pre>

<p>I've tested the contents of the array and they are just fine, so I'm storing correctly the rows. The problem is that I'm using a different method to paste the data in a different sheet in Google Spreadhsheets. My code to do so is the following: </p>

<pre><code>    function pasteInfo()
{
 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var source = ss.getSheetByName("Sheet 1");
 var destination = ss.getSheetByName("Sheet 2");

  var range = source.getRange(initialcoords[1], 1, 8, 3);
  range.copyValuesToRange(destination, 4, 6, 4, 6);
}
</code></pre>

<p>My probelm is the getRange() since it prints an error like this: </p>

<pre><code>can't find method getRange((class),number,number,number). 
</code></pre>

<p>I believe that even if n is declared as an integer, the values that I'm returning are of a different type incompatible with the getRange() method. Could anyone help me to confirm this and to help me convert it to integer? I would really appreciate your help. </p>