I am trying to extend class Sheet in a script and i get Sheet is undefined when it tries to execute the folowing:
Sheet.prototype.moveColumn = function(SourceIndex, DestinationIndex){
var source = this.getRange(1, SourceIndex, ss.getLastRow(), 1).getValues()
var move = SourceIndex-DestinationIndex>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>0 ? sheet.getRange(1, DestinationIndex+1, move.length, move[0].length).setValues(move) : sheet.getRange(1, SourceIndex, move.length, move[0].length);
return this
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…