Add a color filter in an Excel worksheet

This REST API adds a color filter to an Excel worksheet.

REST API

PUT http://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/autoFilter/colorFilter

Prerequisites – The endpoint requires OAuth 2.0 authentication. Obtain a JWT token as described in the Aspose.Cells Cloud authentication guide and pass it in the request header as Authorization: Bearer <jwt token>. The API version is v3.0, and the workbook must be stored in Aspose Cloud Storage (or another supported storage) before the call.

The request parameters are:

Parameter Name Type Location Description
name string path The name of the Excel file.
sheetName string path The name of the worksheet that contains the data to be filtered.
range string query The cell range to which the filter is applied (e.g., A1:B10).
fieldIndex integer query Zero‑based index of the column on which the color filter is applied.
colorFilter object body JSON object that defines the foreground and background colors to filter.
matchBlanks boolean query Whether rows with blank cells should be included in the filter results.
refresh boolean query If true, the worksheet is refreshed after applying the filter.
folder string query The folder in storage where the Excel file is located.
storageName string query The name of the storage service (e.g., Aspose Cloud Storage).

colorFilter JSON schema

Property Type Description Required
Pattern string Filter pattern (e.g., "Solid"). Yes
ForegroundColor object Defines the foreground color. Contains sub‑properties such as Color, ColorIndex, IsShapeColor, ThemeColor, and Type. No
BackgroundColor object Defines the background color. Same sub‑properties as ForegroundColor. No

The OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

You can use the cURL command‑line tool to access Aspose.Cells web services easily. The following example shows how to make calls to the Cloud API with cURL.

Error handling – The API may return standard error objects. Example responses:

// 400 Bad Request  missing or invalid parameters
{
  "Code": 400,
  "Message": "Invalid request parameters."
}
// 401 Unauthorized  authentication failed or token missing
{
  "Code": 401,
  "Message": "Authentication failed. Please provide a valid JWT token."
}

Cloud SDK Family

Using an SDK is the best way to speed up development. An SDK abstracts low‑level details so you can focus on your project tasks. Please check out the GitHub repository for a complete list of Aspose.Cells Cloud SDKs.

The following code examples demonstrate how to call Aspose.Cells web services using various SDKs: