---
title: "POST /v4/spreadsheets/{spreadsheetId}:getByDataFilter"
method: POST
path: "/v4/spreadsheets/{spreadsheetId}:getByDataFilter"
tags: ["spreadsheets"]
---

# POST /v4/spreadsheets/{spreadsheetId}:getByDataFilter

`POST /v4/spreadsheets/{spreadsheetId}:getByDataFilter`

Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. For more information, see [Read, write, and search metadata](https://developers.google.com/workspace/sheets/api/guides/metadata). This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters returns the portions of the spreadsheet that intersect ranges matched by any of the filters. By default, data within grids is not returned. You can include grid data in one of two ways: * Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP. * Set the includeGridData parameter to `true`. If a field mask is set, the `includeGridData` parameter is ignored. For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.

## Path parameters

- `spreadsheetId` string, required

## Request body

- GetSpreadsheetByDataFilterRequest — The request for retrieving a Spreadsheet.
  - `dataFilters` DataFilter[] — The DataFilters used to select which ranges to retrieve from the spreadsheet.
    - `a1Range` string — Selects data that matches the specified A1 range.
    - `gridRange` GridRange — A range on a sheet. All indexes are zero-based. Indexes are half open, i.e. the start index is inclusive and the end index is exclusive -- [start_index, end_index). Missing indexes indicate the range is unbounded on that side. For example, if `"Sheet1"` is sheet ID 123456, then: `Sheet1!A1:A1 == sheet_id: 123456, start_row_index: 0, end_row_index: 1, start_column_index: 0, end_column_index: 1` `Sheet1!A3:B4 == sheet_id: 123456, start_row_index: 2, end_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1!A:B == sheet_id: 123456, start_column_index: 0, end_column_index: 2` `Sheet1!A5:B == sheet_id: 123456, start_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1 == sheet_id: 123456` The start index must always be less than or equal to the end index. If the start index equals the end index, then the range is empty. Empty ranges are typically not meaningful and are usually rendered in the UI as `#REF!`.
      - `endRowIndex` integer — The end row (exclusive) of the range, or not set if unbounded.
      - `sheetId` integer — The sheet this range is on.
      - `endColumnIndex` integer — The end column (exclusive) of the range, or not set if unbounded.
      - `startRowIndex` integer — The start row (inclusive) of the range, or not set if unbounded.
      - `startColumnIndex` integer — The start column (inclusive) of the range, or not set if unbounded.
    - `developerMetadataLookup` DeveloperMetadataLookup — Selects DeveloperMetadata that matches all of the specified fields. For example, if only a metadata ID is specified this considers the DeveloperMetadata with that particular unique ID. If a metadata key is specified, this considers all developer metadata with that key. If a key, visibility, and location type are all specified, this considers all developer metadata with that key and visibility that are associated with a location of that type. In general, this selects all DeveloperMetadata that match the intersection of all the specified fields; any field or combination of fields may be specified.
      - `locationType` 'DEVELOPER_METADATA_LOCATION_TYPE_UNSPECIFIED' | 'ROW' | 'COLUMN' | 'SHEET' | 'SPREADSHEET' — Limits the selected developer metadata to those entries which are associated with locations of the specified type. For example, when this field is specified as ROW this lookup only considers developer metadata associated on rows. If the field is left unspecified, all location types are considered. This field cannot be specified as SPREADSHEET when the locationMatchingStrategy is specified as INTERSECTING or when the metadataLocation is specified as a non-spreadsheet location. Spreadsheet metadata cannot intersect any other developer metadata location. This field also must be left unspecified when the locationMatchingStrategy is specified as EXACT.
      - `metadataKey` string — Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_key.
      - `metadataValue` string — Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_value.
      - `visibility` 'DEVELOPER_METADATA_VISIBILITY_UNSPECIFIED' | 'DOCUMENT' | 'PROJECT' — Limits the selected developer metadata to that which has a matching DeveloperMetadata.visibility. If left unspecified, all developer metadata visible to the requesting project is considered.
      - `locationMatchingStrategy` 'DEVELOPER_METADATA_LOCATION_MATCHING_STRATEGY_UNSPECIFIED' | 'EXACT_LOCATION' | 'INTERSECTING_LOCATION' — Determines how this lookup matches the location. If this field is specified as EXACT, only developer metadata associated on the exact location specified is matched. If this field is specified to INTERSECTING, developer metadata associated on intersecting locations is also matched. If left unspecified, this field assumes a default value of INTERSECTING. If this field is specified, a metadataLocation must also be specified.
      - `metadataId` integer — Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_id.
      - `metadataLocation` DeveloperMetadataLocation — A location where metadata may be associated in a spreadsheet.
        - `sheetId` integer — The ID of the sheet when metadata is associated with an entire sheet.
        - `spreadsheet` boolean — True when metadata is associated with an entire spreadsheet.
        - `dimensionRange` DimensionRange — A range along a single dimension on a sheet. All indexes are zero-based. Indexes are half open: the start index is inclusive and the end index is exclusive. Missing indexes indicate the range is unbounded on that side.
          - `sheetId` integer — The sheet this span is on.
          - `startIndex` integer — The start (inclusive) of the span, or not set if unbounded.
          - `dimension` 'DIMENSION_UNSPECIFIED' | 'ROWS' | 'COLUMNS' — The dimension of the span.
          - `endIndex` integer — The end (exclusive) of the span, or not set if unbounded.
        - `locationType` 'DEVELOPER_METADATA_LOCATION_TYPE_UNSPECIFIED' | 'ROW' | 'COLUMN' | 'SHEET' | 'SPREADSHEET' — The type of location this object represents. This field is read-only.
  - `includeGridData` boolean — True if grid data should be returned. This parameter is ignored if a field mask was set in the request.
  - `excludeTablesInBandedRanges` boolean — True if tables should be excluded in the banded ranges. False if not set.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/sheets.md) · [All operations](https://skmtc.dev/google/apis/sheets/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/sheets/revisions/89de4914a876/schema)
