Google App Script / Spreadsheet - How to get filter criteria?

后端 未结 6 527
自闭症患者
自闭症患者 2020-12-10 18:18

Is it possible to get the filter criteria of my data set. For example, if one of my column is \"Department\" and I filtered the data to display only \"IT\". How do we get th

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 18:41

    Filters are now available using with the recent launch of the Advanced Sheets Service: Here is a link to the article

    Here is a little snippet of how to do :

    function setSheetBasicFilter(ssId, BasicFilterSettings) {
      //requests is an array of batchrequests, here we only use setBasicFilter
      var requests = [
        {
          "setBasicFilter": {
            "filter": BasicFilterSettings
          }
        }
      ];
      Sheets.Spreadsheets.batchUpdate({'requests': requests}, ssId);
    }
    

提交回复
热议问题