Categories

CSV Transformer

Transform and process CSV data with column operations, calculations, and data type conversions. Supports renaming columns, adding calculated columns, removing columns, converting data types, calculating values, and filtering rows. Operation examples: • Rename column: [{"type": "rename", "column": "old_name", "new_name": "new_name"}] • Add calculated column: [{"type": "add_column", "new_column": "total", "formula": "price * quantity"}] • Remove column: [{"type": "remove_column", "remove_column": "column_to_remove"}] • Convert data type: [{"type": "convert_type", "convert_column": "age", "target_type": "number"}] • Calculate values: [{"type": "calculate", "target_column": "total", "expression": "price * tax + shipping"}] • Filter rows: [{"type": "filter_values", "filter_column": "status", "operator": "equals", "value": "active"}]

Click to upload file or drag and drop file here

Maximum file size: 10MB

Key Facts

Category
Data Processing
Input Types
file, textarea, select, checkbox
Output Type
file
Sample Coverage
4
API Ready
Yes

Overview

The CSV Transformer is a powerful utility designed to clean, restructure, and analyze your CSV data through precise column operations, mathematical calculations, and automated data type conversions.

When to Use

  • When you need to clean or restructure large CSV datasets by removing unnecessary columns or renaming headers.
  • When you must perform bulk calculations across rows, such as computing totals or applying tax rates to existing data.
  • When you need to filter specific rows based on criteria or convert data types to ensure consistency for downstream analysis.

How It Works

  • Upload your CSV file and define your desired operations using the JSON configuration field.
  • Specify transformation rules such as renaming columns, adding calculated fields, or filtering rows based on specific values.
  • Select your preferred output format and error handling strategy to ensure the processed data meets your requirements.
  • Execute the transformation to generate your cleaned and structured data file.

Use Cases

Standardizing inconsistent column names across multiple exported datasets for unified reporting.
Automating the calculation of financial metrics like tax, shipping, or total price directly within the data file.
Filtering large raw datasets to extract only relevant records, such as active users or completed transactions.

Examples

1. Calculate Order Totals

Data Analyst
Background
An analyst has a sales export containing 'price' and 'quantity' columns but lacks a 'total' column for reporting.
Problem
Manually calculating totals for thousands of rows is error-prone and inefficient.
How to Use
Upload the sales CSV and use the 'add_column' operation to compute the total.
Example Config
[{"type": "add_column", "new_column": "total", "formula": "price * quantity"}]
Outcome
A new 'total' column is appended to the CSV, containing the product of price and quantity for every row.

2. Filter Active Customers

Marketing Manager
Background
A CRM export contains customer data with a 'status' column, but the marketing team only needs to contact 'active' users.
Problem
The raw file is too large and contains irrelevant data for the email campaign tool.
How to Use
Upload the customer list and apply a filter operation to keep only active records.
Example Config
[{"type": "filter_values", "filter_column": "status", "operator": "equals", "value": "active"}]
Outcome
The resulting file contains only the rows where the status is 'active', ready for immediate import into the email platform.

Try with Samples

json, csv, video

Related Hubs

FAQ

What types of operations can I perform on my CSV?

You can rename columns, add new calculated columns, remove columns, convert data types, perform complex calculations, and filter rows based on specific conditions.

How do I define the transformation rules?

Transformation rules are defined using a JSON array format in the 'Transformations' field, where each object specifies the operation type and relevant parameters.

Can I output the result in a format other than CSV?

Yes, the tool supports exporting your processed data as CSV, JSON, or a summary report.

How does the tool handle errors during processing?

You can configure error handling to either skip the problematic row, keep the original value, set it to empty, or throw an error to stop the process.

Is there a limit to the number of transformations I can apply?

You can chain multiple operations within the JSON array to perform complex data manipulation in a single pass.

API Documentation

Request Endpoint

POST /en/api/tools/csv-transformer

Request Parameters

Parameter Name Type Required Description
csvFile file (Upload required) Yes -
transformations textarea Yes -
outputFormat select No -
includeHeader checkbox No -
handleErrors select No -
errorHandling select No -

File type parameters need to be uploaded first via POST /upload/csv-transformer to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-csv-transformer": {
      "name": "csv-transformer",
      "description": "Transform and process CSV data with column operations, calculations, and data type conversions. Supports renaming columns, adding calculated columns, removing columns, converting data types, calculating values, and filtering rows.

Operation examples:
• Rename column: [{\"type\": \"rename\", \"column\": \"old_name\", \"new_name\": \"new_name\"}]
• Add calculated column: [{\"type\": \"add_column\", \"new_column\": \"total\", \"formula\": \"price * quantity\"}]
• Remove column: [{\"type\": \"remove_column\", \"remove_column\": \"column_to_remove\"}]
• Convert data type: [{\"type\": \"convert_type\", \"convert_column\": \"age\", \"target_type\": \"number\"}]
• Calculate values: [{\"type\": \"calculate\", \"target_column\": \"total\", \"expression\": \"price * tax + shipping\"}]
• Filter rows: [{\"type\": \"filter_values\", \"filter_column\": \"status\", \"operator\": \"equals\", \"value\": \"active\"}]",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=csv-transformer",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]