我正在尝试在脚本中扩展类 Sheet ,当它尝试执行以下操作时,我得到 Sheet is undefined :
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
}