# CSV Data Cleaner & Profiler (`cleancellco/csv-data-cleaner-profiler`) Actor

Clean and profile your own CSV/JSON: normalize emails, phones, dates and amounts, remove duplicates, flag bad rows, and get a quality report plus an XLSX file.

- **URL**: https://apify.com/cleancellco/csv-data-cleaner-profiler.md
- **Developed by:** [Clean Cell Co.](https://apify.com/cleancellco) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## CSV Data Cleaner & Profiler

Clean and profile your own CSV or JSON data: trim and normalize text, standardize emails, phones, dates and currency amounts, remove duplicates, flag bad rows, and get a column-by-column quality profile.

Works only on data you supply. It doesn't crawl, scrape or log in to anything.

### Input

- `csvText`: paste a CSV (header row required), or
- `rows`: an array of JSON objects, or
- `csvUrl`: a direct public http(s) link to your own file. One single download: no redirects followed, no crawling, 50 MB cap, 60-second limit. Private, local and internal addresses are blocked, including the address actually connected to.
- Options: `dedupeKeys`, `requiredColumns`, `normalizeColumns`, `columnTypes`, `dateFormat`, `delimiter`, `dropEmptyColumns`, `xlsxOutput`.

### Output

| Where | Content |
| --- | --- |
| Dataset | Cleaned rows |
| Key-value store `CLEANED_CSV` / `CLEANED_XLSX` | Cleaned file |
| `REJECTED` | Rejected rows with reasons |
| `REPORT` | Column profile before/after, normalization stats |
| `OUTPUT` | Summary counts |

**Spreadsheet-safe output.** In `CLEANED_CSV`, any text cell (header included) that starts with `=`, `+`, `-`, `@`, a tab or a carriage return gets a single leading `'`, so Excel, LibreOffice and Google Sheets show it as text instead of running it as a formula. Plain numbers such as `-20.5` or `+15551234567` are not changed. If you need the exact raw text, strip a leading `'` from those cells, or use the dataset or `CLEANED_XLSX`. In `CLEANED_XLSX`, text is always stored as literal text (never a formula), and currency amounts and number columns stay real numbers, negatives included.

### Privacy and data retention

Your data stays only in this run's own Apify storage (its default dataset and key-value store). The Actor keeps no copy anywhere else and sends your data nowhere. Apify's standard data retention for your plan applies to that run storage; delete the run's storage yourself if you want it gone sooner. Don't include data you aren't allowed to process.

### Pricing

Free during launch; pricing may be added later with notice.

### Disclaimer

Automated cleaning can be wrong. Review the report and rejected rows before using the output.

# Actor input Schema

## `csvText` (type: `string`):

Paste your CSV (header row required).

## `csvUrl` (type: `string`):

Direct public http(s) link to your own file (max 50 MB). Private/local addresses blocked. Single download, no crawling.

## `rows` (type: `array`):

Alternative: array of objects.

## `delimiter` (type: `string`):

Auto-detected if empty.

## `dedupeKeys` (type: `array`):

Empty = whole-row duplicates.

## `requiredColumns` (type: `array`):

Column names that must be present and non-empty; rows missing them are rejected.

## `normalizeColumns` (type: `array`):

Empty = all columns (kinds auto-detected).

## `columnTypes` (type: `object`):

e.g. {"Phone":"phone","Joined":"date"}; kinds: email, phone, date, currency.

## `dateFormat` (type: `string`):

Output format for normalized dates (e.g. ISO YYYY-MM-DD).

## `dropEmptyColumns` (type: `boolean`):

Remove columns that are empty in every row.

## `xlsxOutput` (type: `boolean`):

Also save the cleaned data as an XLSX file.

## Actor input object example

```json
{
  "csvText": "Customer ID;Full Name;Email;Phone;Joined;Spend;Notes\nC1;  Jane   Doe ;JANE@Example.COM;(212) 555-0101;01/15/2026;$1,250.00;\nC2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip\nC2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip\nC3;Bad Mail;bad@;555;13/45/2026;abc;\nC4;No Phone;n@example.com;;2026/03/01;(20.50);N/A\n",
  "dateFormat": "%Y-%m-%d",
  "dropEmptyColumns": false,
  "xlsxOutput": true
}
```

# Actor output Schema

## `cleanedRows` (type: `string`):

Cleaned rows as JSON items in the run's default dataset.

## `report` (type: `string`):

JSON quality report: normalization stats, column kinds and before/after column profiles.

## `cleanedCsv` (type: `string`):

Cleaned data as CSV. Text cells starting with = + - @, tab or carriage return get a leading ' so spreadsheet apps treat them as text; numbers are unchanged.

## `cleanedXlsx` (type: `string`):

Cleaned data as an Excel workbook. Text is stored as literal text (never formulas); numbers and currency amounts stay numeric.

## `rejected` (type: `string`):

JSON list of rejected rows with source line numbers and reasons.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "csvText": `Customer ID;Full Name;Email;Phone;Joined;Spend;Notes
C1;  Jane   Doe ;JANE@Example.COM;(212) 555-0101;01/15/2026;$1,250.00;
C2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip
C2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip
C3;Bad Mail;bad@;555;13/45/2026;abc;
C4;No Phone;n@example.com;;2026/03/01;(20.50);N/A`
};

// Run the Actor and wait for it to finish
const run = await client.actor("cleancellco/csv-data-cleaner-profiler").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "csvText": """Customer ID;Full Name;Email;Phone;Joined;Spend;Notes
C1;  Jane   Doe ;JANE@Example.COM;(212) 555-0101;01/15/2026;$1,250.00;
C2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip
C2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip
C3;Bad Mail;bad@;555;13/45/2026;abc;
C4;No Phone;n@example.com;;2026/03/01;(20.50);N/A
""" }

# Run the Actor and wait for it to finish
run = client.actor("cleancellco/csv-data-cleaner-profiler").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "csvText": "Customer ID;Full Name;Email;Phone;Joined;Spend;Notes\\nC1;  Jane   Doe ;JANE@Example.COM;(212) 555-0101;01/15/2026;$1,250.00;\\nC2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip\\nC2;John Roe;john@example.com;212.555.0102;2026-02-03;$80;vip\\nC3;Bad Mail;bad@;555;13/45/2026;abc;\\nC4;No Phone;n@example.com;;2026/03/01;(20.50);N/A\\n"
}' |
apify call cleancellco/csv-data-cleaner-profiler --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cleancellco/csv-data-cleaner-profiler"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/l2ajICIgBIqIaPhuY/builds/9WpgKgFyUixeNf3c9/openapi.json
