---
title: "Loop over CSV"
icon: "file-csv"
---

The CSV Loop feature enables your agent to process data systematically by iterating through each row or column of a CSV file. **Each iteration triggers a separate agent execution**, making it ideal for batch processing operations.

This powerful capability is especially valuable for:

- Data cleaning and standardization
- Large-scale content generation
- Data enrichment and validation
- Automated analysis across multiple records

## Set Up CSV Looping

Follow these steps to configure and use the CSV Loop feature:

1. **Navigate to Behavior Settings:**
   In **Agent Studio**, go to **Behavior**.
2. **Enable CSV Loop:**\
   Toggle on the **Loop over CSV** option.

   <Note>
     Enabling this feature activates the CSV upload functionality in the **Playground**.
   </Note>
3. **Upload Your CSV:**
   In the **Playground**, you will now see a CSV upload option. Upload your desired CSV file.
4. **Configure Iteration:**
   Select whether you want the agent to loop over **rows** or **columns**.
5. **Start the Loop:**
   Configure your agent's message or prompt as needed. Send the message in the chat to initiate the loop operation.

## Monitor Loop Progress

You can track the progress of your CSV loop as it runs:

- **Real-time Tracking:** Monitor loop progress directly in the **Playground** chat interface while it's active.
- **Session Limitation:**

  <Warning>
    If you close the **Playground** and return later, the real-time loop progress will not be visible in the chat history.
  </Warning>
- **Completion Notification:** Once the loop completes, you'll receive a summary notification in the **Notification Center**.

## Common Use Cases

The CSV Loop is powerful for various tasks, including:

### Data Cleaning and Standardization

**Scenario:** Process a CSV file containing inconsistent or incomplete data.

**Input Data Issues Examples:**

- Inconsistent address formats
- Missing company websites
- Varied job title formats
- Incomplete contact information

**Agent Actions:**

- **Address Processing:** Parse and reformat addresses into a standard structure (e.g., Street, City, State, Zip).
- **Phone Number Standardization:** Convert phone numbers to a consistent format.
- **Website Enrichment:** If **CompanyName** exists but **Website** is missing, search the web for the official company website.
- **Industry Classification:** Infer **Industry** or **CompanySize** categories based on **JobTitle** and **CompanyName**.

**Output:** A cleaned and enriched dataset with standardized information.

### Product Description Generation

**Scenario:** Create unique product descriptions from attribute data.

**Input Data Examples:**

- `ProductName`
- `Features` (list or descriptive text)
- `Material specifications`
- `TargetAudience` demographics
- `ProductCategory`

**Agent Actions:**

- **Feature Analysis:** Analyze product features and benefits.
- **Audience Targeting:** Tailor language and messaging to the specified target audience.
- **Description Generation:** Create compelling product descriptions that highlight benefits derived from features.
- **SEO Optimization:** Generate meta descriptions and relevant keywords.
- **Format Optimization:** Structure content with bullet points for key features and benefits.

**Output:** Professional product descriptions ready for e-commerce platforms or marketing materials.

## Best Practices

- **Data Preparation:** Ensure your CSV file is properly formatted with clear column headers.
- **Agent Configuration:** Test your agent's behavior on a small sample of data before processing large datasets.
- **Progress Monitoring:** Keep the **Playground** open during execution to monitor real-time progress.
- **Result Validation:** Review the completion summary and validate the outputs as needed.