# QnA CSV

Import question-answer pairs from CSV.

## Overview

| Property          | Value                                    |
| ----------------- | ---------------------------------------- |
| **Type**          | Static (manual upload)                   |
| **Sync**          | Manual only                              |
| **Plan**          | All plans                                |
| **Format**        | CSV: Question, Answer columns (required) |
| **Encoding**      | UTF-8                                    |
| **Max Rows**      | 10,000 per CSV                           |
| **Max File Size** | 10MB                                     |

## Use Cases

* **FAQs**: Product questions, support questions
* **Migration**: Import existing Q\&A from other systems
* **Exact answers**: Content that must be worded precisely
* **Fast setup**: Deploy agent in minutes with prepared Q\&As

## CSV Format

### Required Columns

Must have exactly these 2 columns (case-insensitive):

| Column                   | Description   | Max Length  |
| ------------------------ | ------------- | ----------- |
| `question` or `Question` | Question text | 500 chars   |
| `answer` or `Answer`     | Answer text   | 5,000 chars |

### Example

```csv
question,answer
What are your business hours?,We are open Monday-Friday 9 AM-5 PM EST.
How do I reset my password?,Click 'Forgot Password' on the login page and follow the email instructions.
What payment methods do you accept?,We accept Visa, Mastercard, Amex, and PayPal.
```

**Additional columns ignored**: You can add `category`, `priority`, etc. for your reference, but only `question` and `answer` are indexed.

### Escaping Rules

**Commas in text**: Use quotes

```csv
question,answer
"What's included: features, pricing, and support?","Includes features, pricing, and 24/7 support."
```

**Quotes in text**: Double them

```csv
question,answer
"What does ""premium"" mean?","Premium means full access."
```

**Newlines**: Use quotes and literal newlines

```csv
question,answer
"How do I contact support?","Email: support@example.com
Phone: 1-800-123-4567
Chat: Available on website"
```

## Creating Your QnA CSV File

### Using Microsoft Excel

1. Open Excel
2. Create headers: `Question` in column A, `Answer` in column B
3. Fill in your question-answer pairs
4. Click **File** → **Save As**
5. Choose **CSV (Comma delimited) (\*.csv)** format
6. Save the file

### Using Google Sheets

1. Open Google Sheets
2. Create headers: `Question` in column A, `Answer` in column B
3. Fill in your question-answer pairs
4. Click **File** → **Download** → **Comma-separated values (.csv)**

### Using a Text Editor

Create a plain text file with `.csv` extension:

```csv
Question,Answer
"What is your return policy?","We offer 30-day returns on all unused products with original packaging."
"Do you ship internationally?","Yes, we ship to over 50 countries worldwide."
```

**Important:** Use quotes around values containing commas, newlines, or quotes.

## How to Add QnA CSV

### Step 1: Navigate to Data Sources

1. Log in to your Twig AI account
2. Click **Data** in the main navigation menu
3. Click **Add Data Source** or the **+** button

### Step 2: Select QnA CSV Connector

1. Choose **QnA as a CSV** from the list
2. The connector shows: "CSV file with a Question & Answer columns"

### Step 3: Configure the Data Source

#### Basic Information

* **Name** (required): Descriptive name for your Q\&A collection
  * Example: "Product FAQ", "Customer Support Q\&A", "Technical FAQs"
* **Description** (optional): Additional context
  * Example: "Top 100 customer questions from Q4 2023"

#### File Upload

1. Click **Choose File** or drag-and-drop your CSV file
2. Upload your `.csv` file
3. Wait for upload completion

#### Tags (Optional)

* Add organizational tags
* Examples: "faq", "customer-support", "product", "technical"

### Step 4: Save and Process

1. Click **Save** or **Create**
2. The system will validate and process your CSV
3. Check for any errors in the process logs

### Step 5: Verify Import

1. Check the record count matches your CSV rows
2. Review status: should show "END\_PROCESS"
3. Test by asking questions from your CSV

## Best Practices

### 1. Question Formatting

**Good Questions:**

* Natural language: "How do I reset my password?"
* Multiple phrasings: Include variations people might ask
* Clear and specific: "What is the refund policy for digital products?"

**Avoid:**

* Too vague: "Help?"
* Keywords only: "password reset"
* Multiple questions in one: "How do I reset password and change email?"

### 2. Answer Quality

**Good Answers:**

* Complete: Provide full information
* Actionable: Include specific steps
* Concise: Stay on topic
* Formatted: Use clear structure

**Example:**

```csv
Question,Answer
How do I reset my password?,"To reset your password:
1. Go to the login page
2. Click 'Forgot Password'
3. Enter your email address
4. Check your email for reset link
5. Follow the link and create new password

The link expires in 24 hours."
```

### 3. Content Organization

**Group Related Topics:**

```csv
Question,Answer
[Product] What is Product X?,[Detailed description]
[Product] How much does Product X cost?,[Pricing details]
[Shipping] How long does shipping take?,[Shipping timeframes]
[Shipping] What are shipping costs?,[Shipping costs]
```

### 4. Handling Special Characters

**Commas in Text:**

```csv
Question,Answer
"What's included: features, pricing, and support?","Product includes features, competitive pricing, and 24/7 support."
```

**Quotes in Text:**

```csv
Question,Answer
"What does ""premium"" mean?","Premium means access to all advanced features."
```

**Newlines in Answers:**

```csv
Question,Answer
How do I contact support?,"You can reach us via:
- Email: support@example.com
- Phone: 1-800-123-4567
- Live Chat: Available on our website"
```

## CSV Format Requirements

### Encoding

* **Recommended:** UTF-8
* Ensures proper handling of special characters
* Save with UTF-8 encoding in your editor

### Delimiters

* **Comma (,)** - Standard and recommended
* Other delimiters may not be supported

### Headers

* Must have a header row
* Column names: `Question` and `Answer` (case-insensitive)
* No spaces before/after column names

### Row Limits

* Varies by plan
* Split large CSVs into multiple data sources if needed

## Examples

### Example 1: Customer Support FAQ

```csv
Question,Answer
How do I track my order?,"Log into your account, go to 'My Orders', and click on the order number to see tracking information."
What is your return policy?,"We accept returns within 30 days of purchase. Items must be unused and in original packaging."
Do you offer gift wrapping?,"Yes, gift wrapping is available for $5 per item during checkout."
```

### Example 2: Technical Documentation

```csv
Question,Answer
What API version should I use?,"We recommend using API v2. API v1 is deprecated and will be sunset on December 31, 2024."
How do I authenticate API requests?,"Include your API key in the Authorization header: 'Authorization: Bearer YOUR_API_KEY'"
What is the rate limit?,"Standard accounts have 1000 requests/hour. Premium accounts have 10000 requests/hour."
```

### Example 3: Product Information

```csv
Question,Answer
What are the system requirements?,"Windows 10 or later, 8GB RAM minimum, 16GB recommended, 500MB free disk space."
Is there a mobile app?,"Yes, our mobile app is available for iOS 14+ and Android 10+ devices on App Store and Google Play."
Can I use this offline?,"Yes, core features work offline. Sync occurs automatically when you reconnect to the internet."
```

## Updating Your QnA CSV

Since this is a static connector:

### To Add Questions:

1. Update your CSV file with new rows
2. Re-upload the updated CSV file
3. The system will reprocess all content

### To Modify Existing Questions:

1. Edit your CSV file
2. Re-upload the complete file
3. Previous version will be replaced

### Best Practice:

* Keep a master CSV file
* Version your files: `faq-v1.csv`, `faq-v2.csv`
* Document changes in a separate changelog

## Troubleshooting

### CSV Not Parsing

**Problem:** File uploaded but no questions imported

**Solutions:**

* Verify headers are exactly `Question,Answer`
* Check for UTF-8 encoding
* Ensure proper comma separation
* No empty rows between data

### Missing Questions

**Problem:** Some questions not imported

**Solutions:**

* Check for empty Answer fields (not allowed)
* Verify no malformed CSV rows
* Look for unescaped quotes or commas
* Check character encoding issues

### Incorrect Formatting

**Problem:** Answers appear garbled or broken

**Solutions:**

* Re-save CSV with UTF-8 encoding
* Properly escape special characters
* Use quotes around fields with commas
* Check for hidden characters

### AI Not Using Q\&A

**Problem:** AI doesn't reference imported Q\&As

**Solutions:**

* Verify questions match how users actually ask
* Check processing completed successfully
* Ensure AI agent has access to this data source
* Test with exact questions from CSV first

## Advanced Tips

### 1. Question Variations

Include multiple variations of the same question:

```csv
Question,Answer
How do I reset my password?,Click 'Forgot Password' on login page...
I forgot my password,Click 'Forgot Password' on login page...
Can't log in - forgot password,Click 'Forgot Password' on login page...
Password reset help,Click 'Forgot Password' on login page...
```

### 2. Context in Answers

Provide rich context to help AI understand when to use each answer:

```csv
Question,Answer
What's the shipping time?,"Standard shipping takes 5-7 business days within the continental US. Express shipping takes 2-3 business days. International shipping varies by destination (7-21 business days)."
```

### 3. Cross-References

Link related topics in answers:

```csv
Question,Answer
How do I return a product?,"We accept returns within 30 days. See our full return policy for details. For exchange information, ask about our exchange process."
```

## Next Steps

After importing your QnA CSV:

1. Test the knowledge by asking questions
2. [Create targeted AI agents](/product/overview/add-an-ai-agent-persona.md) for specific topics
3. [Monitor which questions users ask](/product/monitoring/view-analytics.md)
4. Iterate and improve your Q\&A content based on analytics

## Related Connectors

* [Data CSV](/product/data-integrations/data-csv.md) - Import tabular data
* [Files](/product/data-integrations/files.md) - Upload document files
* [Website](/product/data-integrations/website.md) - Crawl FAQ pages
* [Confluence](/product/data-integrations/confluence.md) - Sync wiki-based Q\&As


---

# Agent Instructions: 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:

```
GET https://help.twig.so/product/data-integrations/qna-csv.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
