# CRM Lead Data Cleaner (Email/Phone Validator + Dedup) (`motivational_nickel/universal-data-cleaner`) Actor

Turn messy CSV or Excel leads into clean, validated, CRM-ready data. Fix Excel E+11 phone numbers, validate emails, remove duplicates, and score lead quality (HIGH, MEDIUM, LOW). Built for sales teams, lead gen agencies, and automation workflows.

- **URL**: https://apify.com/motivational\_nickel/universal-data-cleaner.md
- **Developed by:** [Leoncio Jr Coronado](https://apify.com/motivational_nickel) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 11 total users, 0 monthly users, 89.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## CRM Lead Data Cleaner – Email/Phone Validator + Dedup

Turn messy CSV and Excel lead data into clean, standardized, CRM-ready records.

CRM Lead Data Cleaner normalizes phone numbers, cleans and validates email formats, removes duplicate records, standardizes text fields, and assigns lead-quality scores.

Built for lead generation, CRM imports, outreach workflows, and data automation pipelines.

***

### What It Does

The Actor processes messy lead datasets and produces structured records that are easier to import into CRMs and downstream automation systems.

Key capabilities:

- Normalize phone numbers
- Recover phone numbers stored in Excel scientific notation
- Clean and validate email syntax
- Remove known placeholder or invalid email values
- Remove duplicate records
- Normalize column headers
- Clean text formatting
- Score email and phone data quality
- Assign HIGH, MEDIUM, or LOW lead-quality classifications
- Process CSV and Excel files
- Generate structured Apify Dataset output
- Generate a cleaned CSV file for downstream use

***

### Quick Start

Provide either:

1. A public CSV/XLSX file URL, or
2. An uploaded file key

Do not provide both in the same run.

#### Example

```json
{
  "file_url": "https://example.com/leads.csv",
  "max_rows": 1000
}
```

The Actor downloads the dataset, cleans the records, removes duplicates, calculates quality scores, and writes the processed leads to the Apify Dataset.

***

### Input

#### `file_url`

Public URL of the CSV or Excel dataset to process.

Example:

```text
https://example.com/leads.csv
```

The URL must be accessible without authentication.

#### `file_key`

Key of a file available through the Actor's key-value storage workflow.

Use this instead of `file_url` when processing an uploaded file.

#### `max_rows`

Maximum number of cleaned rows to process.

Example:

```json
{
  "max_rows": 1000
}
```

***

### Supported File Formats

The Actor supports:

- CSV
- XLSX
- XLS

The file-loading pipeline selects the appropriate parser based on the supplied file type.

Excel files are processed using the Excel parser, while CSV files use the CSV parsing pipeline.

This prevents binary Excel workbook data from being incorrectly decoded as UTF-8 CSV text.

***

### Data Cleaning

#### Phone Numbers

Phone fields are detected automatically when the column name contains `phone`.

The Actor:

- Removes non-numeric formatting
- Normalizes phone values
- Handles numbers stored using scientific notation
- Rejects values with fewer than 7 digits
- Produces normalized phone output

Example input:

```text
9.171234567E+09
```

Normalized output:

```text
'+9171234567
```

The leading apostrophe helps preserve the phone number as text when opened in spreadsheet applications.

***

### Email Cleaning

Email fields are detected automatically when the column name contains `email`.

The Actor:

- Trims whitespace
- Converts email addresses to lowercase
- Checks basic email syntax
- Removes empty values
- Rejects known placeholder values such as `dummy`, `test`, `noemail`, and `not_unlocked`

Example:

```text
 JOHN@EXAMPLE.COM
```

becomes:

```text
john@example.com
```

#### Important

Email validation is syntax-based.

The Actor does **not** verify mailbox existence, perform SMTP verification, or guarantee that an email address can receive messages.

***

### Duplicate Removal

Duplicate records are removed after normalization and cleaning.

This helps reduce repeated CRM entries and duplicate outreach records.

***

### Header Normalization

Column names are automatically standardized.

For example:

```text
First Name
Phone Number
Email Address
```

become:

```text
first_name
phone_number
email_address
```

Headers are:

- Converted to lowercase
- Trimmed
- Converted to underscore-separated field names

***

### Lead Quality Scoring

The Actor calculates three scoring fields.

#### `email_score`

```text
1.0 = valid email syntax
0.0 = missing or invalid email
```

#### `phone_score`

```text
1.0 = 10 or more digits
0.5 = 7–9 digits
0.0 = missing or invalid phone
```

#### `overall_score`

Calculated from:

```text
(email_score + phone_score) / 2
```

The final record is classified as:

```text
HIGH    overall_score >= 0.8
MEDIUM  overall_score >= 0.5
LOW     overall_score < 0.5
```

These scores provide a simple way to prioritize records based on the completeness and basic validity of their contact information.

They are data-quality indicators, not guarantees that a lead will respond or convert.

***

### Output

Each cleaned lead is written to the Apify Dataset.

Example:

```json
{
  "first_name": "John",
  "last_name": "Smith",
  "phone_number": "'+9171234567",
  "email_address": "john@example.com",
  "address": null,
  "city": null,
  "facebookprofileurl": null,
  "email_score": 1,
  "phone_score": 1,
  "overall_score": 1,
  "quality": "HIGH"
}
```

#### Standard Output Fields

| Field | Description |
|---|---|
| `first_name` | Lead first name |
| `last_name` | Lead last name |
| `phone_number` | Normalized phone number |
| `email_address` | Cleaned email address |
| `address` | Address when available |
| `city` | City when available |
| `facebookprofileurl` | Facebook profile URL when available |
| `email_score` | Email quality score |
| `phone_score` | Phone quality score |
| `overall_score` | Combined contact-data score |
| `quality` | HIGH, MEDIUM, or LOW |

Missing optional values are returned as `null`.

***

### Cleaned CSV

In addition to Dataset output, the Actor generates a cleaned CSV representation of the processed dataframe in key-value storage under:

```text
cleaned_dataset
```

This can be useful for spreadsheet workflows, exports, or downstream processing.

***

### Error Handling

The Actor uses controlled failure handling for common operational problems.

Examples include:

```text
missing_input
invalid_input
file_not_found
download_failed
invalid_file
```

This makes failures easier to diagnose in automated workflows.

For example, providing neither `file_url` nor `file_key` produces a `missing_input` failure, while providing both produces `invalid_input`.

***

### Use Cases

#### CRM Data Preparation

Clean lead lists before importing them into CRM platforms.

#### Lead Generation Pipelines

Place the Actor between a scraper and your CRM:

```text
Scraper
   ↓
CRM Lead Data Cleaner
   ↓
CRM / Outreach / Automation
```

#### Sales Outreach

Standardize contact information and remove duplicate records before outreach.

#### Spreadsheet Cleanup

Repair common formatting problems in CSV and Excel lead files.

#### Automation Workflows

Use the structured Dataset output in Apify integrations, APIs, or external automation workflows.

***

### Typical Workflow

```text
Raw CSV / Excel
       ↓
File Detection
       ↓
CSV / Excel Parser
       ↓
Header Normalization
       ↓
Text Cleaning
       ↓
Email + Phone Processing
       ↓
Duplicate Removal
       ↓
Quality Scoring
       ↓
CRM-Ready Dataset
```

***

### Pricing

This Actor uses pay-per-result pricing.

```text
1 cleaned dataset row = 1 result
```

You pay based on the number of results produced, subject to the current pricing displayed on the Actor's Apify Store page.

Use `max_rows` to control how many records are processed in a run.

***

### Limitations

CRM Lead Data Cleaner focuses on deterministic data cleaning and basic contact-data validation.

It does not currently:

- Verify whether an email mailbox actually exists
- Perform SMTP verification
- Verify whether a phone number is active
- Identify the phone carrier or line owner
- Enrich missing contact information from external sources
- Bypass authentication to access private files

Input URLs must be publicly accessible unless the file is supplied through the supported uploaded-file workflow.

***

### Privacy and Data Handling

Lead datasets can contain personal or business contact information.

Use this Actor only with data you are authorized to process and in accordance with applicable privacy, data-protection, outreach, and platform requirements.

The Actor's Sentry configuration disables default PII collection:

```python
send_default_pii=False
```

Secrets and credentials should never be embedded directly in public dataset URLs or source files.

***

### Built for Automation

CRM Lead Data Cleaner is designed to work as a reusable data-processing stage rather than only as a standalone cleaning tool.

A typical production pipeline can look like:

```text
Web Scraper
    ↓
Raw Lead Dataset
    ↓
CRM Lead Data Cleaner
    ↓
Validated / Scored Dataset
    ↓
CRM
    ↓
Outreach or Automation
```

This makes it suitable for lead-generation systems, sales operations, data pipelines, and automated CRM workflows.

***

### Reliability

The Actor includes:

- Explicit input validation
- Separate CSV and Excel parsing paths
- Controlled download handling
- Structured parsing failure handling
- Deterministic cleaning rules
- Duplicate removal
- Structured Dataset output
- Lead-quality scoring
- Production error observability

The goal is simple:

**Turn messy lead data into predictable, automation-ready output.**

# Actor input Schema

## `file_url` (type: `string`):

Public URL of CSV or Excel file to clean

## `file_key` (type: `string`):

Key of uploaded file in Key-Value Store (e.g., input.csv)

## `max_rows` (type: `integer`):

Limit number of rows to process

## Actor input object example

```json
{
  "file_url": "https://docs.google.com/spreadsheets/d/e/2PACX-1vRUO0cXpOhderaslH-xn2bcsq2ATI9v8mQ4hFm5AnxqFoZgjpX3-yAfSZZXk8koY_LcK-xk3LF96kZS/pub?output=csv",
  "max_rows": 10000
}
```

# Actor output Schema

## `results` (type: `string`):

CRM-ready cleaned lead records stored in the default dataset.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("motivational_nickel/universal-data-cleaner").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("motivational_nickel/universal-data-cleaner").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 '{}' |
apify call motivational_nickel/universal-data-cleaner --silent --output-dataset

```

## MCP server setup

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

```

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/famuVy1l0g0kCnRxr/builds/VM1Gxwc96QPaYrzB8/openapi.json
