> ## Documentation Index
> Fetch the complete documentation index at: https://docs.requestly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Collections with Custom Data

> Learn how to use CSV or JSON data files with the Requestly Collection Runner to iterate requests with multiple input values.

You can use **custom data files** (CSV or JSON) when running a collection manually in Requestly.\
This enables you to iterate through your requests using multiple sets of input values, without modifying your request parameters each time.

<Note>
  **Note:** This feature is currently available only on the [Requestly Desktop App](https://requestly.com/downloads/desktop/).
</Note>

Use this feature to test APIs with dynamic inputs, such as running the same workflow for multiple users, IDs, or configurations.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/j-oh6pe51Vw?si=RUH0MpYQ3bdTdgJd" />

### Using a Data File in Collection Runner

Follow these steps to run a collection with custom data:

<Steps>
  <Step title="Open Collection Runner">
    In the Collections sidebar, find the collection you want to execute and click the **Run** icon next to it.

    <img src="https://mintcdn.com/requestly/Ann0jEECfxHAT9FZ/images/DataFileSupportincollectionRunner(runcollection).png?fit=max&auto=format&n=Ann0jEECfxHAT9FZ&q=85&s=97f338c499c852e6a56a995da1655997" alt="Requestly Collection Runner interface showing how to open and run an API collection from the Collections sidebar or Runner tab." width="2144" height="1250" data-path="images/DataFileSupportincollectionRunner(runcollection).png" />
  </Step>

  <Step title="Select a Data File">
    In the Runner configuration panel, click **Select Data File**.

    <Note>
      Supports JSON & CSV files (max 100MB)
    </Note>

    <img src="https://mintcdn.com/requestly/Ann0jEECfxHAT9FZ/images/DataFilesupportinCollectionRunner(addfile).png?fit=max&auto=format&n=Ann0jEECfxHAT9FZ&q=85&s=f51aee821fd18041ed97d202688af600" alt="Runner configuration panel in Requestly showing the Select Data File option to upload a CSV or JSON file for data-driven API testing." width="1934" height="1108" data-path="images/DataFilesupportinCollectionRunner(addfile).png" />

    Once added, Requestly will automatically detect the file type and preview its structure.
  </Step>

  <Step title="Preview Data and Map Variables">
    After selecting the file, a **preview** of your data will appear.

    * For CSV files: verify column names and types
    * For JSON files: check object keys and structure

    Each key or column name should match the variable used in your requests, such as `{{storyId}}`.

    <img src="https://mintcdn.com/requestly/Ann0jEECfxHAT9FZ/images/DatafilesupportforCollectionRunner(preview).png?fit=max&auto=format&n=Ann0jEECfxHAT9FZ&q=85&s=859991a0ec9d91ef9c67ad00d664dc5b" alt="Requestly data preview screen displaying CSV and JSON structures, allowing users to verify columns, keys, and map variables like city or user_id." width="1848" height="1016" data-path="images/DatafilesupportforCollectionRunner(preview).png" />
  </Step>

  <Step title="Start the Run">
    Click **Save** and then **Start Run**.\
    The Collection Runner will replace variables with data from your file for each iteration.

    <img src="https://mintcdn.com/requestly/Ann0jEECfxHAT9FZ/images/DataSupportinCollectionRunner(save&run).png?fit=max&auto=format&n=Ann0jEECfxHAT9FZ&q=85&s=3ca18e5c047ee425c1fb561776c0aa35" alt="Requestly Collection Runner executing an API collection with data variables replaced from the selected CSV or JSON file." width="1698" height="998" data-path="images/DataSupportinCollectionRunner(save&run).png" />
  </Step>
</Steps>

### How Data Files Work

When you attach a CSV or JSON file to your manual run:

* Each **row (CSV)** or **object (JSON)** represents one **iteration**
* Variables inside your requests (like `{{storyId}}`) will be replaced with the corresponding values
* Requestly automatically cycles through each data set until all iterations are complete

### Supported File Formats

#### CSV Format

* The first row defines variable names
* Each subsequent row represents one iteration
* Each row must have the same number of columns

**Example:**

```bash theme={null}
city,temperature  
Vancouver,10  
Austin,24  
London,12
```

#### JSON Format

* Must be an array of key-value objects
* Each object defines one iteration

**Example:**

```json theme={null}
[  
  { "city": "Vancouver", "temperature": 10 },  
  { "city": "Austin", "temperature": 24 },  
  { "city": "London", "temperature": 12 }  
]
```

### Example Use Case

For a request like

```bash theme={null}
GET https://api.example.com/weather?city={{city}}
```

and a data file containing

```bash theme={null}
city
Vancouver
Austin
London
```

Requestly will automatically replace `{{city}}` with each value during the run.

### Accessing Data in Scripts

You can access data file values programmatically in your pre-request and post-response scripts using the `rq.iterationData` object. This allows you to implement conditional logic, validate responses, or perform calculations based on the input data.

**Example:**

```javascript theme={null}
// Pre-request script
const city = rq.iterationData.get("city");
console.log(`Testing weather API for: ${city}`);

// Post-response script
const expectedCity = rq.iterationData.get("city");
const responseData = rq.response.json();

rq.test("Response contains correct city", function() {
    rq.expect(responseData.city).to.equal(expectedCity);
});
```
