# CSV & JSON Cleaner + PDF Text Extractor (`dimpled_sunglow/csv-json-cleaner-pdf-text-extractor`) Actor

Clean CSV and JSON files, remove duplicate rows, and extract text from supported PDFs automatically. Process up to 10 files per run, 3 MB per-file limit, download cleaned results in one ZIP, and pay $0.05 per successfully processed file. Scanned PDFs requiring OCR are not supported.

- **URL**: https://apify.com/dimpled_sunglow/csv-json-cleaner-pdf-text-extractor.md
- **Developed by:** [SMP122](https://apify.com/dimpled_sunglow) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 file processeds

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?

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

## Smart File Processor — CSV & JSON Cleaner + PDF Text Extractor

Clean spreadsheet-ready data or extract text from PDFs in seconds. Submit a file, run the Actor, and download **`RESULTS.zip`** containing your processed files and a summary. No spreadsheet software is required.

### What you get

| Input | Output | Processing |
| --- | --- | --- |
| CSV (`.csv`) | `*_clean.csv` | Normalizes column headers, trims values, removes exact duplicate rows and empty rows |
| JSON (`.json`) | `*_clean.csv` | Converts object records into tabular CSV; nested values become JSON strings |
| JSON Lines (`.jsonl`) | `*_clean.csv` | Converts newline-delimited JSON objects to CSV |
| PDF (`.pdf`) | `*_text.txt` | Extracts existing selectable text, with page markers |

**Limits:** Up to **10 files per run**; **3 MB per file**; up to **15,000 data rows per CSV/JSON/JSONL file**; up to **60 pages per PDF**. PDF conversion is **text extraction only**—it does **not** perform OCR, read image-only scans, or preserve complex table layouts. Exact duplicate removal is not fuzzy matching; malformed files may be rejected.

### Quick start: paste CSV or JSON (no upload storage required)

1. Open the Actor's **Input → Form** tab.

2. In **1. Paste CSV / JSON / JSONL text**, paste raw data such as:

   ```csv
   name,email
   Alice,alice@example.com
   Alice,alice@example.com
   Bob,bob@example.com
   ```

3. Keep **2. Filename for pasted text** as `pasted.csv`. Leave the upload fields empty.

4. Select **Start**. After the run succeeds, open the run's **Output** tab or **Storage → Key-value store**, and download **`RESULTS.zip`**.

The example produces `pasted_clean.csv` with two data rows, plus `MANIFEST.json` documenting the result. For JSON, paste raw JSON and set the filename to `pasted.json`, such as:

```json
[
  {"name": "Alice", "active": true},
  {"name": "Bob", "active": false}
]
```

**Tip:** In the Form tab, paste only the CSV or JSON data into the paste field, **not** an entire Actor input JSON object. The **Input → JSON** editor is for the full configuration.

### Upload files from your computer (CSV, JSON, JSONL, PDF)

Apify stores file uploads in a key-value store. This Actor uses **Limited permissions**, so you explicitly choose which private store it can read. You only need to create the named store once and can reuse it.

1. In Apify **Storage → Key-value stores**, create a **named, private** store (for example `my-file-uploads`) if you don't already have one.
2. Return to this Actor's **Input → Form**. Under **3. Upload files from your computer**, select that **named private store** and upload the files. Do not use the automatically created unnamed store.
3. Under **4. Select the upload store**, **choose that same store from the picker**. This gives the Actor read-only access to the selected store for the run. You no longer need to type the store name manually.
4. Leave the paste-text field blank, start the run, and download **`RESULTS.zip`** from the run's output/key-value store.

If the storage picker is empty, create a named store first, refresh the Input page, and select that same store in both fields. Do not switch the Actor to Full permissions. If you only have a few CSV/JSON rows, using paste-text avoids this extra step.

### Output and error reporting

For successfully processed files, **`RESULTS.zip`** includes each output file and `MANIFEST.json`. The Actor's default key-value store also contains individual `OUTPUT_...` files, and the default dataset shows per-file status, row counts, warnings, and whether the processing event was recorded.

An invalid or unsupported file is listed as **failed** in the manifest rather than stopping the whole batch. When no files succeed, the run may still complete with `processed: 0`; check `MANIFEST.json` and the dataset for the reason.

### Price

**$0.05 per successfully processed input file.** A rejected file does not incur the `processed-file` processing charge. The separately configured **Actor Start** event is approximately **$0.00005 per run**; check the pricing tab for current displayed terms. A batch of five successfully processed files costs **$0.25 in processing events**, plus the start event. Other Apify charges, if any, follow the pricing shown on the Store page.

### API / automation input

To avoid Apify file-upload storage when integrating programmatically, send base64-encoded files through `inlineFiles`:

```json
{
  "fileUploads": [],
  "inlineFiles": [
    {
      "filename": "customers.csv",
      "content_base64": "bmFtZSxlbWFpbApBbGljZSxhbGljZUBleGFtcGxlLmNvbQo="
    }
  ],
  "pasteText": "",
  "allowMixedSources": false
}
```

Each base64 object counts as one submitted file. The default input prevents pasted data and existing uploads from being processed together accidentally; set `allowMixedSources` to `true` only when you intentionally want a mixed batch.

### Privacy, retention and limitations

Input and output are stored in your Apify storages according to the applicable platform/account retention settings. **This Actor does not automatically erase your uploaded source files or reports after a fixed period.** Review/delete storage records when needed and avoid uploading sensitive or regulated records unless the storage and privacy settings suit your use case.

The processor does not send file contents to an external AI/OCR service. File-download URLs are limited to Apify key-value-store records. This is a file-conversion utility, not a malware scanner or a service for recovering corrupted documents. CSV output includes basic spreadsheet-formula safeguards, but you should still review important files.

Need help? Open the **Issues** tab on the Actor Store page and include the run ID, file type, and error code (but **do not** post private file contents or credentials).

# Actor input Schema

## `pasteText` (type: `string`):

Paste raw CSV, JSON, or JSONL content here, not a full JSON configuration. Leave blank when uploading files. Up to 3 MB; paste input is one billable file if processed successfully.

## `pasteFilename` (type: `string`):

For pasted content, enter pasted.csv, pasted.json or pasted.jsonl. Not used if no text is pasted.

## `fileUploads` (type: `array`):

Instead of pasting text, upload up to 10 CSV, JSON, JSONL or text-based PDF files to a NAMED PRIVATE Apify key-value store. After uploading, select this same store in field 4 below. Avoid the default unnamed store. File size limit: 3 MB each.

## `uploadStore` (type: `string`):

Select the SAME named private key-value store you used in field 3. Grants this run READ-only access to that store. No selection needed for pasted text or inlineFiles. If nothing appears, create a named store in Apify Storage, then refresh Input.

## `inlineFiles` (type: `array`):

For API callers. JSON array with {"filename": "sample.csv", "content_base64": "..."}; at most 10 files across all methods. Leave empty for normal form use.

## `allowMixedSources` (type: `boolean`):

Off by default to prevent double submissions and unintended per-file charges. Enable ONLY when deliberately combining pasted text with uploaded or API files.

## Actor input object example

```json
{
  "pasteFilename": "pasted.csv",
  "allowMixedSources": false
}
```

# Actor output Schema

## `files` (type: `string`):

Open the Files view and download RESULTS.zip, or individual OUTPUT\_... files.

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

One status row per submitted file with processing details and billing status.

# 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("dimpled_sunglow/csv-json-cleaner-pdf-text-extractor").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("dimpled_sunglow/csv-json-cleaner-pdf-text-extractor").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 dimpled_sunglow/csv-json-cleaner-pdf-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dimpled_sunglow/csv-json-cleaner-pdf-text-extractor"
        }
    }
}
```

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/u84qJKNXF50bUhKF1/builds/b1S3oLtwcpgkr6UOx/openapi.json
