1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "csvText": """Customer ID, Full Name ,Email,Amount,Order Date
10C-001, Alice Smith ,ALICE@ACME.COM,1250.50,2026-08-01
11C-001,Alice Smith,alice@acme.com,1250.50,2026-08-01""",
12 "format": "auto",
13 "normalizeColumnNames": True,
14 "trimWhitespace": True,
15 "emptyAsNull": True,
16 "columnRules": [
17 {
18 "column": "amount",
19 "type": "number",
20 "required": True,
21 "min": 0,
22 },
23 {
24 "column": "order_date",
25 "type": "date",
26 "required": True,
27 },
28 {
29 "column": "email",
30 "type": "string",
31 "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
32 },
33 ],
34 "deduplicateBy": [
35 "customer_id",
36 "order_date",
37 ],
38 "duplicateAction": "flag",
39 "caseInsensitiveDuplicates": True,
40 "maxRows": 20,
41}
42
43
44run = client.actor("automation-lab/csv-excel-data-quality-cleaner").call(run_input=run_input)
45
46
47print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
48for item in client.dataset(run.default_dataset_id).iterate_items():
49 print(item)
50
51