> For the complete documentation index, see [llms.txt](https://docs.rowsncolumns.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rowsncolumns.app/configuration/features/autofill.md).

# Autofill

Spreadsheet 2 does a series autofill based on the value of selected cells. This can be customized, if you need autofill to be powered by AI or an async API

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

const MySpreadsheet = () => {
  const {  } = useSpreadsheetState({
    getAutoFillValues: async ({
      sheetId,
      direction,
      selection,
      fillBounds,
      getCellData,
      locale
    }) => {
      // return an array of cellData
    }
  })

  
  return (
    <CanvasGrid />
  );
};

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