# SpreadsheetAddAutofilter

Adds auto filters to a spreadsheet.

## Method Signature

```
SpreadsheetAddAutofilter(spreadsheetObj=[any], row=[any], startColumn=[any], endRow=[any], endColumn=[any])
```

### Arguments

| Argument         | Type      | Required | Description                                                                                   | Default |
| ---------------- | --------- | -------- | --------------------------------------------------------------------------------------------- | ------- |
| `spreadsheetObj` | `ANY`     | `true`   | The spreadsheet object.                                                                       |         |
| `row`            | `NUMERIC` | `false`  | The starting row for the autofilter (1-based). Default is 1.                                  | 1       |
| `startColumn`    | `NUMERIC` | `false`  | The starting column for the autofilter (1-based). Default is 1.                               | 1       |
| `endRow`         | `NUMERIC` | `false`  | The ending row for the autofilter (1-based). If not specified, uses all rows with data.       |         |
| `endColumn`      | `NUMERIC` | `false`  | The ending column for the autofilter (1-based). If not specified, uses all columns with data. |         |

## Examples

Add autofilter to data range:

```js
// Add filter to header row
var spreadsheet = SpreadsheetNew();
SpreadsheetAddRows( spreadsheet, [ 
    [ "Name", "Age", "City" ],
    [ "John", 30, "NYC" ],
    [ "Jane", 25, "LA" ]
] );

SpreadsheetAddAutofilter( spreadsheet, 1, 1, 3, 3 );
```

## Related

* [SpreadsheetAddFreezePane()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetaddfreezepane.md) - Freeze panes
* [SpreadsheetFormatRow()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatrow.md) - Format row
* [Data Analysis Guide](https://github.com/ortus-boxlang/boxlang-docs/blob/v1.x/boxlang-framework/boxlang-plus/modules/bx-spreadsheet/data-analysis.md) - Data filtering


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetaddautofilter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
