# Bind Test to External Data Source

Test Studio allows you to use external data files for data driven testing. In this article you can read how to associate a test to an external data source.

If you have already related the external data source to a test in the project, follow <a href="/automated-tests/data-drive-test/external-data-driven-test" target="_blank">this link to go through a complete scenario for data driven test with external data source</a>.

## Bind the External Data Source to Test

Once you have <a href="/features/data-driven-testing/add-data-source" target="_blank">added a data source definition to your test project</a>, you are ready to bind your test to that data source.

Choose a test from the *Project Explorer* and click the **Bind Test** button from the *Data Source* section in the *Project* ribbon.

![choose-test-to-bind](https://www.telerik.com/teststudio/documentation/assets/cc3999d39e711e849247f42aa46fdff8/choose-test-to-bind.png)

The **Bind test to data source** dialog opens with the option to choose a data source. Click the **Select Data Source** drop-down and select the one you have  defined. If your source is an Excel spreadsheet, choose which sheet from the spreadsheet to use. Once you select a sheet, the data from that sheet will be read and displayed in the dialog. Check out that the **first row of the spreadsheet is used to define the column names**.

<table id="no-table" style="border:none;">
<tr style="text-align: center; background-color: transparent; border:none;">
<td>

<img src="/teststudio/documentation/assets/ee82a493a9767e7cfe7feea3c5bb1af5/fig3.png" alt="Bind test to data source window" /></td>

<td>

<img src="/teststudio/documentation/assets/44d468e35c5b6466d5d78362fda7b9cf/fig4.png" alt="Select Data Source" /></td>

</tr>
<tr style="text-align: center; background-color: transparent; border:none;">
<td>

**Choose Data Source to Bind**</td>

<td>

**Excel Sheet Selected**</td>

</tr>
</table>

> **Note**
> <br>
> <br>
> You need to have **Microsoft Excel** installed on this machine and/or the **Microsoft Access Database Engine 2010** - see <a href="/troubleshooting-guide/test-execution-problems-tg/unable-to-show-data" target="_blank">this article</a> for more information.

## External Data Source Options

Some of the supported type of files to add as external data source allow you **to limit the rows** of it to use. This option is applicable for Excel file or SQL database.

### Limit the Rows to Use from Excel File

If you need to use only part of the rows in an Excel sheet, you can enable the **Filter data between rows** box under the **Configure** section.

* If left unchecked, all data rows will be used during the test run.
* To limit which rows to use, check that box and select which rows you want to use by clicking the numeric up/down counters, and then **Update** to apply changes.

<table id="no-table" style="border:none;">
<tr style="text-align: center; background-color: transparent; border:none;">
<td>

<img src="/teststudio/documentation/assets/6795e8803fa8b618a83020e1685633a7/fig5.png" alt="filter data" /></td>

<td>

<img src="/teststudio/documentation/assets/9f73fffd0d6fb07ecdc1c291f0ddee41/fig6.png" alt="filter data" /></td>

</tr>
</table>

### Use Specific Data from SQL Data Source

If your source is a SQL database, you can use a T-SQL query to select the data you want. Using T-SQL, you can get as complex as you need in your SQL select statement. Check out the example below.

![SQL database](https://www.telerik.com/teststudio/documentation/assets/e139dc53e7ae19581745a2ca8bb3154d/fig7.png)

Once your select statement is entered, click the **Update** button to test the results - the **Preview** table shows these.

## Confirm Data Binding

When the external data source is set as desired, click the **OK** button to bind it to the selected test. Now the external file is associated with the test and you can access the data values to bind the steps.

> **Tip**
> <br>
> <br>
> Check <a href="/features/data-driven-testing/manage-external-data-source" target="_blank">how to modify the external data source</a> after it is referenced in the Test Studio project.

## Remove Data Binding

To remove the external data source associated with a test, right click that test on the **Project** tab and select **Remove Data Binding**.

![Remove Data Binding](https://www.telerik.com/teststudio/documentation/assets/232888b674eeee8f367416674844f835/fig8.png)
