title: Google Spreadsheet Script: "Cannot find function getRange in object Sheet" when creating a simple function
body: <p>Sorry, for the stupid question, but I´ve searched the whole internet and I could not find a good Tutorial to learn how to program in Google SpreadSheet Script.</p>
  
  <p>I want to make a very simple function just for practice.</p>
  
  <pre><code>function simplesum(input) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets();
    var range = sheet.getRange(input);
  
  var x = 0;
  
  for (var i = 1; i &lt;= range.getNumRows(); i++) {
  for (var j = 1; j &lt;= range.getNumColumns(); j++) {
  
  var cell = range.getCell(i, j);
  
  x += (cell.getValue());
  }
  }
  
  return x;
  }
  </code></pre>
  
  <p>I know I could use =sum() to do exactly the same thing. The idea here is to learn how to program.</p>
  
  <p>When I try to use my function in a cell: (i.e: =simplesum((A1:A8)) it gives an Error saying: "TypeError: Cannot find function getRange in object Sheet. (line 4)"</p>
  
  <p>What should I do?</p>
  
  <p>And again, sorry for the dumb question....</p>