Supercharge your CSV files with AI-powered data processing
CSV Worker is a powerful command-line tool that leverages OpenRouter's AI models to process and enrich your CSV data. Whether you need to add new columns with AI-generated content or transform existing data, CSV Worker makes it simple and efficient.
- 🤖 AI-Powered Processing: Uses OpenRouter API with Google Gemini 2.5 Flash Lite for fast, intelligent data processing
- 📊 Flexible Operations: Add new columns or edit existing ones with custom prompts
- 🔄 Batch Processing: Group rows by columns for efficient batch operations
- ⚡ Real-time Updates: See your CSV file update as each row is processed
- 🛡️ Safe Operations: Optional output file preserves your original data
git clone https://github.com/yourusername/csv-worker.git
cd csv-worker
pip install -e .- Python 3.7+
- requests
- python-dotenv
-
Set up your OpenRouter API key
export OPENROUTER_API_KEY="your-api-key-here" # or create a .env file with: OPENROUTER_API_KEY=your-api-key-here
-
Process your first CSV
csv-worker data.csv --add-column "sentiment" --prompt "Analyze the sentiment of this text"
csv-worker <csv_file> [OPTIONS] --prompt "<your prompt>"| Option | Description |
|---|---|
--add-column COLUMN |
Add a new column with the specified name |
--edit-column COLUMN |
Edit an existing column |
--prompt PROMPT |
Your prompt for the AI (required) |
--system-prompt PROMPT |
Custom system prompt (default: helpful assistant) |
--group-by COLUMNS |
Comma-separated columns to group by for batch processing |
--output, -o FILE |
Output file path (preserves original if specified) |
csv-worker reviews.csv --add-column "sentiment" --prompt "Classify the sentiment as positive, negative, or neutral"csv-worker articles.csv --add-column "entities" --prompt "Extract named entities from this text"csv-worker products.csv --add-column "description" --group-by "category" --prompt "Generate a compelling product description"csv-worker emails.csv --edit-column "subject" --prompt "Make this subject line more engaging"csv-worker data.csv --add-column "processed" --prompt "Process this data" --output "processed_data.csv"- Data Enrichment: Add AI-generated insights to existing datasets
- Text Analysis: Perform sentiment analysis, entity extraction, or classification
- Content Generation: Create descriptions, summaries, or transformations
- Data Cleaning: Standardize and normalize text data
- Batch Processing: Efficiently process large datasets by grouping
Create a .env file in your project directory:
OPENROUTER_API_KEY=your_api_key_here- Use specific, clear prompts for better results
- Group similar rows together with
--group-byfor more consistent batch processing - Always test with a small sample first using the
--outputoption - The tool processes rows sequentially and saves after each operation for data safety
Made with ❤️ for data enthusiasts