> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear selected range content

> Remove all content from the selected table range



## OpenAPI

````yaml /swagger.json patch /table/{tableId}/selection/clear
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /table/{tableId}/selection/clear:
    patch:
      tags:
        - selection
      summary: Clear selected range content
      description: Remove all content from the selected table range
      parameters:
        - schema:
            type: string
          required: true
          name: tableId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                viewId:
                  type: string
                  example: viwXXXXXXX
                  description: >-
                    Set the view you want to fetch, default is first view.
                    result will filter and sort by view options.
                ignoreViewQuery:
                  anyOf:
                    - type: string
                    - type: boolean
                  description: >-
                    When a viewId is specified, configure this to true will
                    ignore the view's filter, sort, etc
                filterByTql:
                  type: string
                  example: '{field} = ''Completed'' AND {field} > 5'
                  deprecated: true
                filter:
                  type: object
                  description: >-
                    A filter object for complex query conditions based on
                    fields, operators, and values. Use our visual query builder
                    at https://app.teable.ai/developer/tool/query-builder to
                    build filters.
                search:
                  anyOf:
                    - type: array
                      items:
                        type: string
                      minItems: 1
                      maxItems: 1
                    - type: array
                      items:
                        type: string
                      minItems: 2
                      maxItems: 2
                    - type: array
                      items:
                        anyOf:
                          - type: string
                          - anyOf:
                              - type: string
                              - type: boolean
                      minItems: 3
                      maxItems: 3
                  default:
                    - searchValue
                    - fieldIdOrName
                    - false
                  description: Search for records that match the specified field and value
                filterLinkCellCandidate:
                  anyOf:
                    - type: array
                      items:
                        type: string
                      minItems: 2
                      maxItems: 2
                    - type: string
                  example:
                    - fldXXXXXXX
                    - recXXXXXXX
                  description: >-
                    Filter out the records that can be selected by a given link
                    cell from the relational table. For example, if the
                    specified field is one to many or one to one relationship,
                    recordId for which the field has already been selected will
                    not appear.
                filterLinkCellSelected:
                  anyOf:
                    - type: array
                      items:
                        type: string
                      minItems: 2
                      maxItems: 2
                    - type: string
                  example:
                    - fldXXXXXXX
                    - recXXXXXXX
                  description: >-
                    Filter out selected records based on this link cell from the
                    relational table. Note that viewId, filter, and orderBy will
                    not take effect in this case because selected records has it
                    own order. Ignoring recordId gets all the selected records
                    for the field
                selectedRecordIds:
                  type: array
                  items:
                    type: string
                  description: Filter selected records by record ids
                orderBy:
                  type: array
                  description: >-
                    An array of sort objects that specifies how the records
                    should be ordered.
                groupBy:
                  type: array
                  nullable: true
                  items:
                    type: object
                    properties:
                      fieldId:
                        type: string
                        description: The id of the field.
                      order:
                        type: string
                        enum:
                          - asc
                          - desc
                    required:
                      - fieldId
                      - order
                collapsedGroupIds:
                  type: array
                  items:
                    type: string
                queryId:
                  type: string
                  example: qry_xxxxxxxx
                  description: >-
                    When provided, other query parameters will be merged with
                    the saved ones.
                projection:
                  type: array
                  items:
                    type: string
                  description: >-
                    If you want to get only some fields, pass in this parameter,
                    otherwise all visible fields will be obtained
                ranges:
                  type: array
                  items:
                    type: array
                    items:
                      type: number
                    minItems: 2
                    maxItems: 2
                  minItems: 1
                  description: >-
                    The parameter "ranges" is used to represent the coordinates
                    of a selected range in a table. 
                  example:
                    - - 0
                      - 0
                    - - 1
                      - 1
                type:
                  type: string
                  enum:
                    - rows
                    - columns
                  description: Types of non-contiguous selections
                  example: columns
              required:
                - ranges
      responses:
        '200':
          description: Successful clean up
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request PATCH \
              --url https://app.teable.ai/api/table/%7BtableId%7D/selection/clear \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"viewId":"viwXXXXXXX","ignoreViewQuery":"string","filterByTql":"{field} = '\''Completed'\'' AND {field} > 5","filter":{},"search":["searchValue","fieldIdOrName",false],"filterLinkCellCandidate":["fldXXXXXXX","recXXXXXXX"],"filterLinkCellSelected":["fldXXXXXXX","recXXXXXXX"],"selectedRecordIds":["string"],"orderBy":[],"groupBy":[{"fieldId":"string","order":"asc"}],"collapsedGroupIds":["string"],"queryId":"qry_xxxxxxxx","projection":["string"],"ranges":[[0,0],[1,1]],"type":"columns"}'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/table/%7BtableId%7D/selection/clear';

            const options = {
              method: 'PATCH',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"viewId":"viwXXXXXXX","ignoreViewQuery":"string","filterByTql":"{field} = \'Completed\' AND {field} > 5","filter":{},"search":["searchValue","fieldIdOrName",false],"filterLinkCellCandidate":["fldXXXXXXX","recXXXXXXX"],"filterLinkCellSelected":["fldXXXXXXX","recXXXXXXX"],"selectedRecordIds":["string"],"orderBy":[],"groupBy":[{"fieldId":"string","order":"asc"}],"collapsedGroupIds":["string"],"queryId":"qry_xxxxxxxx","projection":["string"],"ranges":[[0,0],[1,1]],"type":"columns"}'
            };


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'PATCH',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/table/%7BtableId%7D/selection/clear',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              viewId: 'viwXXXXXXX',
              ignoreViewQuery: 'string',
              filterByTql: '{field} = \'Completed\' AND {field} > 5',
              filter: {},
              search: ['searchValue', 'fieldIdOrName', false],
              filterLinkCellCandidate: ['fldXXXXXXX', 'recXXXXXXX'],
              filterLinkCellSelected: ['fldXXXXXXX', 'recXXXXXXX'],
              selectedRecordIds: ['string'],
              orderBy: [],
              groupBy: [{fieldId: 'string', order: 'asc'}],
              collapsedGroupIds: ['string'],
              queryId: 'qry_xxxxxxxx',
              projection: ['string'],
              ranges: [[0, 0], [1, 1]],
              type: 'columns'
            }));
            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"viewId\":\"viwXXXXXXX\",\"ignoreViewQuery\":\"string\",\"filterByTql\":\"{field}
            = 'Completed' AND {field} >
            5\",\"filter\":{},\"search\":[\"searchValue\",\"fieldIdOrName\",false],\"filterLinkCellCandidate\":[\"fldXXXXXXX\",\"recXXXXXXX\"],\"filterLinkCellSelected\":[\"fldXXXXXXX\",\"recXXXXXXX\"],\"selectedRecordIds\":[\"string\"],\"orderBy\":[],\"groupBy\":[{\"fieldId\":\"string\",\"order\":\"asc\"}],\"collapsedGroupIds\":[\"string\"],\"queryId\":\"qry_xxxxxxxx\",\"projection\":[\"string\"],\"ranges\":[[0,0],[1,1]],\"type\":\"columns\"}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("PATCH", "/api/table/%7BtableId%7D/selection/clear",
            payload, headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````