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

后端 未结 6 516
自闭症患者
自闭症患者 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

    This as raised in Google's Issue Tracker as Issue #36753410.

    As of 2018-04-12, they have posted a solution:

    Yesterday we released some new functionality that makes it possible to manipulate filters with Apps Script:

    • https://developers.google.com/apps-script/reference/spreadsheet/range#createFilter()
    • https://developers.google.com/apps-script/reference/spreadsheet/sheet#getfilter
    • https://developers.google.com/apps-script/reference/spreadsheet/filter

    Unfortunately Apps Script still doesn't have methods for determining if a given row or column is hidden by the filter. See comment #157 for a workaround utilizing the Sheets Advanced Service.

    The Filter class lets you get the FilterCriteria for each column in turn.

提交回复
热议问题