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

# Data Seeding

{% hint style="info" %}
Available after impler version `0.9.1`&#x20;
{% endhint %}

To seed the file that gets downloaded as `Sample`, one need to pass `data` in `showWidget` function, which is exported from the `useImpler` hook.

This function, when provided with your data, allows Impler to automatically populate sample files with the specified information.

Here is how to do it,

```jsx
import { useImpler } from '@impler/react';

const { showWidget, isImplerInitiated } = useImpler({
    projectId: "...",
    templateId: "...",
    accessToken: "...",
});

function onShowWidgetClick = () => {
    // Fetch or generate your data from a relevant source
    let data = [ /* Your data here */ ];
    showWidget({ data });
}

<button disabled={!isImplerInitiated} onClick={onShowWidgetClick}>
    Import
</button>
```

## Using the \`showWidget\` Function

1. **Import the `useImpler` Hook:** Start by importing the `useImpler` hook from `@impler/react` into your project. This hook provides access to essential Impler functions.
2. **Initialize Impler**: Create an instance of Impler by calling `useImpler` with the required configuration, including `templateId`, `projectId`, and `accessToken`.
3. **Define Your Data**: In the `onShowWidgetClick` function, gather the data you want to prefill into the sample file. This data should match the structure and content you expect in the final imported files.
4. **Call `showWidget`**: Pass your data to the `showWidget` function, which will handle the process of populating the sample files.
5. **Downloading sample file with data**: Finally, when user clicks on button with text `Import`, the Import widget gets opened. Where by clicking on `Download sample` the user can download the excel file with data provided.

## Benefits at a Glance

* **Efficient Data Import**: Simplify the process of importing relational data by seeding sample file.
* **Developer-Friendly**: Integrate data sources seamlessly into Impler's import workflow.
* **User-Focused**: Enhance the user experience by providing prepopulated sample files for download.

With the Data Seeding feature in Impler, you can save time and effort by automating the generation of sample files.

This is particularly valuable when importing data with complex relationships, ensuring a smooth and efficient data import experience.

***

If you have any questions, suggestions, or comments. Feel free to reach out to us over [**Discord**](https://discord.impler.io). We’re constantly improving to deliver the best Data Importer for your product, and we value your input.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.impler.io/features/data-seeding.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
