title: How to extend Google apps script classes
body: <p>I am trying to extend class Sheet in a script and i get Sheet is undefined when it tries to execute the folowing:</p>
  
  <pre><code>Sheet.prototype.moveColumn = function(SourceIndex, DestinationIndex){
    var source = this.getRange(1, SourceIndex, ss.getLastRow(), 1).getValues()
    var move = SourceIndex-DestinationIndex&gt;0 ? sheet.getRange(1, DestinationIndex,  ss.getLastRow(), SourceIndex-DestinationIndex).getValues() : sheet.getRange(1, SourceIndex, ss.getLastRow(), DestinationIndex-SourceIndex).getValues();
    sheet.getRange(1, DestinationIndex, source.length, 1).setValues(source);
    SourceIndex-DestinationIndex&gt;0 ? sheet.getRange(1, DestinationIndex+1, move.length, move[0].length).setValues(move) : sheet.getRange(1, SourceIndex, move.length, move[0].length);
    return this
  }
  </code></pre>