> For the complete documentation index, see [llms.txt](https://learning.contextqa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learning.contextqa.com/web-testing/importing-and-exporting-data.md).

# Importing and Exporting Data

{% hint style="info" %}
**Who is this for?** Testers, SDETs, and QA managers who need to move test data between workspaces, back it up, seed a new environment, or bulk-edit values outside ContextQA.
{% endhint %}

You can export and import everything in the [Environment Data Management](/web-testing/environment-data-management.md) workspace — environments, environment variables, database configurations, test data profiles, and global variables. Export a surface to download its data as a file, edit or archive it, then import a file to load values back in. Both directions support two file formats:

* **JSON** — best for version control, scripting, and moving data between tools.
* **Excel** (`.xlsx`) — best for editing values in a spreadsheet before importing.

## Prerequisites

* You have a workspace with at least one environment.
* You are a workspace member with permission to edit data (Editor or Admin role).

***

## Supported surfaces

You can export from — and, where noted, import into — each of these surfaces:

| Surface                     | Where to find it                                      | Export | Import                          |
| --------------------------- | ----------------------------------------------------- | ------ | ------------------------------- |
| **Environments**            | Environments tab                                      | Yes    | Yes (creates a new environment) |
| **Environment variables**   | An environment's **Variables** section                | Yes    | Yes                             |
| **Database configurations** | An environment's **Data base configurations** section | Yes    | Yes                             |
| **Test data profiles**      | Test Data Profiles tab                                | Yes    | Yes                             |
| **Global variables**        | Global Data tab                                       | Yes    | Yes                             |

***

## Exporting data

Export downloads the selected data as a JSON or Excel file. Depending on the surface, you can export everything, export only the items you select, or narrow the export to specific content.

### Export all items on a surface

1. Open the surface you want to export — for example, the **Global Data** tab.
2. Click **Export all**.
3. Select a format: **Export as JSON** or **Export as Excel**.
4. ContextQA generates the file and your browser downloads it.

### Export only selected items

Global variables, test data profiles, and database configurations support selective export:

1. Select the checkbox next to each item you want to export. Your selection persists as you move between pages, and a bottom action bar shows the running count.
2. Click **Export** in the action bar.
3. Select a format, then confirm. ContextQA exports only the selected items.

### Choose what an environment export includes

When you export a single environment or the Environments tab, the wizard adds a **What to include** step. Select one of:

| Option                      | Exports                                                                                |
| --------------------------- | -------------------------------------------------------------------------------------- |
| **All**                     | Every variable and database configuration in the environment (downloaded as a `.zip`). |
| **Variables**               | Environment variables only.                                                            |
| **Database configurations** | Database connection configurations only.                                               |

Selecting two or more environments exports them together in a single file.

{% hint style="info" %}
If a surface has nothing to export, ContextQA reports that there is no data to download instead of producing an empty file.
{% endhint %}

***

## Importing data

Import reads a JSON or Excel file and loads its values into the surface. Every import runs through a short wizard: upload the file, choose how to handle duplicates, and review a result summary.

### Download a template first

If you are building an import file from scratch, start from a template so your columns and keys match what ContextQA expects. On the **Global Data** import wizard, select the **JSON** or **Excel** template option to download a sample file, fill in your values, and import it back.

### Import a file

1. Open the surface you want to import into and click **Import**.
2. On the **file** step, upload a `.json` or `.xlsx` file.
3. On the duplicate-handling step, select a strategy (see the following table).
4. Submit the import. ContextQA processes the file and shows a result summary.

### Handle duplicates

When an imported item matches an existing one by name, ContextQA applies the strategy you select:

| Strategy        | What it does                                                              | Available on                                                     |
| --------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| **Override**    | Updates existing items that match by name and adds new ones.              | Global variables, environment variables, database configurations |
| **Replace all** | Clears every existing item on the surface, then imports the file's items. | Environment variables, database configurations                   |
| **Ignore**      | Keeps existing items and skips any duplicates in the file.                | Global variables, environment variables, database configurations |

{% hint style="warning" %}
**Replace all** deletes the surface's current items before importing. This cannot be undone. Export a backup first if you might need the existing values.
{% endhint %}

### Review the import result

After the import runs, the wizard shows a result step with:

* A status message from ContextQA.
* **Succeeded**, **Failed**, and **Total** counts.
* A per-row list of any errors, so you can correct the source file and import again.

The list behind the wizard refreshes automatically, so the imported values appear as soon as you close the wizard.

### Import notes by surface

* **Global variables and environment variables** — Password-type values are shown masked in the wizard preview.
* **Database configurations** — Imported configurations start as **Not verified yet**. Run **Verify** on each one to confirm connectivity before your tests use it.
* **Environments** — Importing on the Environments tab creates a **new** environment and seeds it from the uploaded JSON or Excel files, rather than merging into an existing environment.

***

## Troubleshooting

**The import finished but some rows failed** Open the result step and read the per-row error list. Fix the flagged rows in your source file — a common cause is a missing required column or a value that does not match the column's data type — then import the corrected file again.

**A database configuration shows "Not verified yet" after import** Imported configurations are never auto-verified. Open the configuration and run **Verify** to test the connection.

**Export downloaded a `.zip` instead of a single file** Exporting an environment with **All** selected bundles its variables and database configurations into a `.zip`. Choose **Variables** or **Database configurations** in the **What to include** step to download a single file.

**Nothing downloaded when I clicked Export** The surface has no data to export. Add at least one variable, profile, or configuration and try again.

## Related pages

* [Environment Data Management](/web-testing/environment-data-management.md) — manage environments, profiles, and global variables
* [Test Data Management](/web-testing/test-data-management.md) — variable reference syntax and data-driven testing
* [Database Steps](/web-testing/database-steps.md) — use imported database configurations in test steps
* [Configuring Environments](/execution/environments.md)


---

# 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://learning.contextqa.com/web-testing/importing-and-exporting-data.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.
