Title1

Title2

Title3

13-2 取得排序最大值

  1. Sheet 類別方法
     
      /*======================================
        得到工作表,某欄的最大值,其值必須為 數字
      ======================================*/
      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;
      }

     

  2. 範例
     
      let maxSort = Sheet.maxSn('商品類別', 3);

    將 maxSort 帶入 順序的 default

  3.