title: How to take a single cell and a range in a custom function and take the range data in an array in google sheets
body: <p>Firstly, I am very new here. Searched the whole internet about this and finally landing a question here.</p>
  
  <pre><code> function StockCoverW(stock,range){
  
       var x = stock;
       var r = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
       var r1 = SpreadsheetApp.getActiveSheet().getNamedRanges(range);
      }
  </code></pre>
  
  <p>Here, stock is a single cell for example: A1
  and range is a range of cell for example: A2:E2</p>
  
  <p>so the function call will be StockCoverW(A1,A2:E2)
  now I need to take the values from the range cells into an Array.</p>
  
  <p>Obviously the code here is not correct as cannot debug or do anything.</p>
  
  <p>How to implement this in google spreadsheet script?</p>