# Get conditional formatting

Use this API to get detailed conditional formatting based on a sheetId. Each operation can query up to 10 sheetIds.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/condition_formats
HTTP Method | GET
Supported app types | Custom App、Store App
Required scopes<br>**The scopes required to call this API. You can call the API with any of the scopes.**<br>Enable any scope from the list | View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, and download all files in My Space(drive:drive:readonly)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)<br>View, comment, and export Sheets(sheets:spreadsheet:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `user_access_token`  or  `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[Learn more about how to obtain and use access_token](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Path parameters

Parameter | Type | Description
---|---|---
spreadsheetToken | string | Spreadsheet token. For more information about how to obtain the token, see [Sheets Developer's Guide](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview) | .

### Query parameters
| Parameter             | Type   | Required | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                           | 
| ---------------- | ------ | ---- | ------------------------------------------------------------ | 
| sheet_ids       |array<string>|Yes   | Sheet ID, can be obtained through the [Obtain sheet metadata](https://open.feishu.cn/document/ukTMukTMukTM/uETMzUjLxEzM14SMxMTN) API, separate multiple IDs with commas, for example: xxxID1,xxxID2 | 
###  cURL Request example
```
curl --location --request GET 'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/shtcngNygNfuqhxTBf588jwgWbJ/condition_formats?sheet_ids=Q7PlXT' \
--header 'Authorization: Bearer t-e346617a4acfc3a11d4ed24dca0d0c0fc8e0067e' \
```
## Response  
### Response body
| Parameter                            |Type| Description                                       |
| ----------------------------- |-----| ---------------------------------------- |
|sheet_condition_formats|array<interface>|Spreadsheet conditional formatting information|
| &emsp;∟sheet_id                      |string|Sheet ID                                 |
| &emsp;∟condition_format              || Detailed information for a conditional formatting                              |
| &emsp;&emsp;∟cf_id                  |string| Conditional formatting ID                                  |
| &emsp;&emsp;∟ranges                 |array<string>| Conditional formatting application scope, supported values: sheetId (for a whole sheet); sheetId!1:2 (for a whole row); sheetId!A:B (for a whole column); sheetId!A1:B2 (for a normal range); sheetId!A1:C (apply to the last row). The application scope cannot exceed the total rows and columns of a spreadsheet, and the sheetId must be consistent with the sheetId in the parameters. |
| &emsp;&emsp;∟rule_type              |string| Conditional formatting rule type, supports seven rule types: ***containsBlanks (contains blanks), notContainsBlanks (does not contain blanks), duplicateValues (duplicate values), uniqueValues (unique values), cellIs (limited value range), containsText (contains text content), timePeriod (dates)***                                  |
| &emsp;&emsp;∟attrs                  ||Specific property information for the corresponding rule_type, see [Conditional Formatting User Guide](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/conditionformat/condition-format-guide)                         for details|
| &emsp;&emsp;∟style                  || Conditional formatting style, only supports the following styles                           |
| &emsp;&emsp; &emsp;∟font            || Font style                                     |
| &emsp;&emsp;  &emsp;&emsp; ∟bold     |bool| Bold                                       |
| &emsp;&emsp; &emsp; &emsp;∟italic   |bool| Italics                                       |
| &emsp;&emsp; &emsp;∟text_decoration |int| Text decoration,  0: default, 1: underline, 2: strikethrough , 3: underline and strikethrough        |
| &emsp;&emsp; &emsp;∟fore_color      |string| Text color                                     |
| &emsp;&emsp; &emsp;∟back_color      |string| Background color                                     |
### Response body example

```json
{
    "code": 0,
    "msg": "Success"，
    "data": {
        "sheet_condition_formats": [
            {
                "condition_format": {
                    "cf_id": "r9sYuhgAl6",
                    "ranges": [
                        "uEnW3A!C4:C4"
                    ],
                    "rule_type": "timePeriod",
                    "attrs": [
                        {
                            "operator": "is",
                            "time_period": "today"
                        }
                    ],
                    "style": {
                        "back_color": "#d9f5d6",
                        "font": {
                            "bold": true,
                            "italic": false
                        },
                        "fore_color": "#faf1d1",
                        "text_decoration": 3
                    }
                },
                "sheet_id": "uEnW3A"
            }
        ]
    }
}
```
### Error code

For details, refer to [Server-side error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

