TRUECALC
MCP

data:setFilter

Sets the filter.

Parameters

NameTypeRequiredDescription
sheetstringyes
range{ from: string; to: string }yesThe filter's own range, its FIRST row is the un-hideable header row. Must span more than one row, a single-row range has no body rows to filter.
criteriaarray of { column: string; values: array of string }noPer-column checked-value lists to apply right after creating the filter. A column omitted here starts unfiltered. Defaults to [].

Returns

NameTypeRequiredDescription
range{ from: string; to: string }yesAn inclusive rectangle. from/to may be equal, a single cell.
criteriaarray of { column: string; values: array of string }yesEchoed back exactly as applied.

Schema

Request payload, as JSON Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Payload",
  "type": "object",
  "properties": {
    "sheet": {
      "type": "string"
    },
    "range": {
      "description": "The filter's own range, its FIRST row is the un-hideable header row. Must span more than one row, a single-row range has no body rows to filter.",
      "$ref": "#/$defs/CellRange"
    },
    "criteria": {
      "description": "Per-column checked-value lists to apply right after creating the filter. A column omitted here starts unfiltered.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Criterion"
      },
      "default": []
    }
  },
  "required": [
    "sheet",
    "range"
  ],
  "$defs": {
    "CellRange": {
      "description": "An inclusive rectangle. `from`/`to` may be equal, a single cell.",
      "type": "object",
      "properties": {
        "from": {
          "description": "Top-left cell, e.g. `\"A1\"`.",
          "type": "string"
        },
        "to": {
          "description": "Bottom-right cell, e.g. `\"B3\"`.",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "Criterion": {
      "description": "One column's checked-value list.",
      "type": "object",
      "properties": {
        "column": {
          "description": "An A1 column letter INSIDE `range`, e.g. `\"B\"`, case-insensitive.",
          "type": "string"
        },
        "values": {
          "description": "The raw values to keep VISIBLE, checked in this column, every value not listed here hides its row.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "column",
        "values"
      ]
    }
  }
}

Response payload, as JSON Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Output",
  "type": "object",
  "properties": {
    "range": {
      "$ref": "#/$defs/CellRange"
    },
    "criteria": {
      "description": "Echoed back exactly as applied.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Criterion"
      }
    }
  },
  "required": [
    "range",
    "criteria"
  ],
  "$defs": {
    "CellRange": {
      "description": "An inclusive rectangle. `from`/`to` may be equal, a single cell.",
      "type": "object",
      "properties": {
        "from": {
          "description": "Top-left cell, e.g. `\"A1\"`.",
          "type": "string"
        },
        "to": {
          "description": "Bottom-right cell, e.g. `\"B3\"`.",
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "Criterion": {
      "description": "One column's checked-value list.",
      "type": "object",
      "properties": {
        "column": {
          "description": "An A1 column letter INSIDE `range`, e.g. `\"B\"`, case-insensitive.",
          "type": "string"
        },
        "values": {
          "description": "The raw values to keep VISIBLE, checked in this column, every value not listed here hides its row.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "column",
        "values"
      ]
    }
  }
}

On this page