# Basic filter or Excel AutoFilter

To create a filter from your data,

1. Select a selection or focus on a cell which has some data around it
2. Press `Ctrl/Cmd + Shift + F`
3. Or Right click on the cell and select `Create a filter`

This will convert a selection to a filter

<figure><img src="/files/Nl5j8Yu4SOBPQIdKnSFU" alt=""><figcaption><p>Auto filter</p></figcaption></figure>

Wiring up autofilter using `useSpreadsheetState`

{% code overflow="wrap" %}

```tsx
import {
  SpreadsheetProvider,
  CanvasGrid,
  Sheet
} from "@rowsncolumns/spreadsheet";
import { useState } from "react";
import { useSpreadsheetState } from "@rowsncolumns/spreadsheet-state";

const MySpreadsheet = () => {
  const [ sheets, onChangeSheets ] = useState<Sheet[]>([])
  const { basicFilter, onCreateBasicFilter } = useSpreadsheetState({
    sheets,
  });
  return (
    <CanvasGrid
      basicFilter={basicFilter}
      onCreateBasicFilter={onCreateBasicFilter}
    />
  );
};

const App = () => (
  <SpreadsheetProvider>
    <MySpreadsheet />
  </SpreadsheetProvider>
);
```

{% endcode %}


---

# 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://docs.rowsncolumns.app/configuration/features/basic-filter-or-excel-autofilter.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.
