/*====================================== 得到工作表,某欄的最大值,其值必須為 數字 ======================================*/ static maxSn(sheet, colIndex){ let ws = this.getWs(sheet); let colArray = ws.getRange(2, colIndex, ws.getLastRow()).getValues(); let maxi = Math.max.apply(Math, colArray); return maxi+1; }
let maxSort = Sheet.maxSn('商品類別', 3);
將 maxSort 帶入 順序的 default