Advanced

AI-Powered Features

Smart column mapping and natural language data transformations

ImportCSV includes AI features that make data imports faster and more accurate. These features require connecting to the cloud backend.

Smart Column Mapping

When users upload a CSV, the importer automatically suggests which columns map to your schema fields.

How It Works

  1. Instant suggestions - Column names are matched using similarity (e.g., "Email Address" → email)
  2. AI enhancement - Cloud AI analyzes column names and sample data for smarter matches
  3. Confidence indicators - High-confidence matches show a checkmark; users can always adjust

What Users See

  • Suggested mappings appear automatically after upload
  • High-confidence suggestions are pre-selected
  • Users can click any mapping to change it
  • Unmapped columns are clearly indicated

Graceful Fallback

If the cloud is unavailable or AI features aren't configured:

  • String similarity matching still works
  • Users can manually map all columns
  • No errors shown - the experience degrades gracefully

Natural Language Transformations

Fix validation errors and transform data using plain English prompts.

The Transform Panel

When validation errors occur, users can open the Transform Panel to fix them:

  1. Click "Fix with AI" in the validation step
  2. Describe the fix - e.g., "Fix email addresses" or "Convert dates to YYYY-MM-DD"
  3. Review changes - Each suggestion shows:
    • Original value → New value
    • Confidence indicator (high/medium)
  4. Select changes - Check/uncheck individual fixes
  5. Apply - Selected changes are applied to the data

Common Prompts

The Transform Panel suggests common fixes:

  • "Fix all email addresses"
  • "Convert dates to YYYY-MM-DD format"
  • "Format phone numbers as (XXX) XXX-XXXX"
  • "Capitalize names"
  • "Remove special characters"
  • "Fill empty values with N/A"

What AI Can Fix

Works well:

  • Email format issues (missing @, typos in domains)
  • Date format conversions (MM/DD/YYYY → YYYY-MM-DD)
  • Phone number normalization
  • Text case corrections
  • Whitespace cleanup

Still needs Zod transforms:

  • Complex business logic
  • Custom calculations
  • Data lookups or enrichment
  • Conditional transformations

Setup

Connect to the cloud backend to enable AI features:

import { CSVImporter } from '@importcsv/react';
import { z } from 'zod';

const schema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
  company: z.string().optional()
});

<CSVImporter
  schema={schema}
  backendUrl="https://api.importcsv.com"
  importerKey="your-importer-key"
  onComplete={handleComplete}
/>

Get your importer key from the ImportCSV dashboard.

Local Mode

Without cloud connection, the importer still works:

  • Column mapping uses string similarity (still helpful)
  • Validation uses your Zod schema (full functionality)
  • AI transformations are unavailable
// Local mode - no backendUrl needed
<CSVImporter
  schema={schema}
  onComplete={handleComplete}
/>

Best Practices

  1. Use clear column names in your schema - AI works better when schema field names are descriptive (customer_email vs field1)

  2. Provide sample data in your schema descriptions - Helps AI understand expected formats

  3. Combine with Zod transforms - Use AI for user-facing fixes, Zod transforms for guaranteed formatting

  4. Test with real data - Upload sample CSVs your users will actually import

Next Steps