# DataImportOptions

Canonical page: https://www.adaptabletools.com/docs/reference/dataimportoptions

Options for managing the Data Import function

```ts title="TypeScript"
export interface DataImportOptions<T = Record<string, any>> 
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [fileHandlers](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#filehandlers) | [`DataImportFileHandler`](https://www.adaptabletools.com/docs/reference/dataimportfilehandler.md)`<T>[]` | Custom File Handlers to use for Data Import |
| [handleImportedData](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#handleimporteddata) | `(context: `[`HandleImportedDataContext`](https://www.adaptabletools.com/docs/reference/handleimporteddatacontext.md)`<T>) => Promise<void \| `[`HandleImportedDataResolution`](https://www.adaptabletools.com/docs/reference/handleimporteddataresolution.md)`>` | Function to handle the Imported Data and apply it to the Grid. If not provided then the Data will be applied to the Grid automatically. |
| [textHandler](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#texthandler) | `(text: string) => T[] \| Promise<T[]>` | Handles Importing Data using text |
| [validate](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#validate) | `(context: `[`DataImportValidateContext`](https://www.adaptabletools.com/docs/reference/dataimportvalidatecontext.md)`<T>) => `[`DataImportValidationError`](https://www.adaptabletools.com/docs/reference/dataimportvalidationerror.md)`[] \| undefined` | Function to validate the Imported Data |
| [_getPrimaryKeyValue](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#_getprimarykeyvalue) | `(context: `[`GetPrimaryKeyValueContext`](https://www.adaptabletools.com/docs/reference/getprimarykeyvaluecontext.md)`<T>) => string \| number` | Function to get the Primary Key value for a data row (defaults to value of the primaryKey column)<br/><br/>It might change in a future version |
| [_preprocessRowData](https://www.adaptabletools.com/docs/reference/dataimportoptions.md#_preprocessrowdata) | `(context: `[`PreprocessRowDataContext`](https://www.adaptabletools.com/docs/reference/preprocessrowdatacontext.md)`<T>) => Record<string, any>` | Function to pre-process the data before it is imported<br/><br/>It might change in a future version |

## Property Details

### fileHandlers

Custom File Handlers to use for Data Import

```ts title="TypeScript"
fileHandlers?: DataImportFileHandler<T>[];
```

###### Property Value

[`DataImportFileHandler`](https://www.adaptabletools.com/docs/reference/dataimportfilehandler.md)`<T>[]`

### handleImportedData

Function to handle the Imported Data and apply it to the Grid. If not provided then the Data will be applied to the Grid automatically.

```ts title="TypeScript"
handleImportedData?: (context: HandleImportedDataContext<T>) => Promise<void | HandleImportedDataResolution>;
```

###### Property Value

`(context: `[`HandleImportedDataContext`](https://www.adaptabletools.com/docs/reference/handleimporteddatacontext.md)`<T>) => Promise<void | `[`HandleImportedDataResolution`](https://www.adaptabletools.com/docs/reference/handleimporteddataresolution.md)`>`

### textHandler

Handles Importing Data using text

```ts title="TypeScript"
textHandler?: (text: string) => T[] | Promise<T[]>;
```

###### Property Value

`(text: string) => T[] | Promise<T[]>`

### validate

Function to validate the Imported Data

```ts title="TypeScript"
validate?: (context: DataImportValidateContext<T>) => DataImportValidationError[] | undefined;
```

###### Property Value

`(context: `[`DataImportValidateContext`](https://www.adaptabletools.com/docs/reference/dataimportvalidatecontext.md)`<T>) => `[`DataImportValidationError`](https://www.adaptabletools.com/docs/reference/dataimportvalidationerror.md)`[] | undefined`

### _getPrimaryKeyValue

Function to get the Primary Key value for a data row (defaults to value of the primaryKey column)

It might change in a future version

```ts title="TypeScript"
_getPrimaryKeyValue?: (context: GetPrimaryKeyValueContext<T>) => string | number;
```

###### Property Value

`(context: `[`GetPrimaryKeyValueContext`](https://www.adaptabletools.com/docs/reference/getprimarykeyvaluecontext.md)`<T>) => string | number`

### _preprocessRowData

Function to pre-process the data before it is imported

It might change in a future version

```ts title="TypeScript"
_preprocessRowData?: (context: PreprocessRowDataContext<T>) => Record<string, any>;
```

###### Property Value

`(context: `[`PreprocessRowDataContext`](https://www.adaptabletools.com/docs/reference/preprocessrowdatacontext.md)`<T>) => Record<string, any>`
