1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "spreadsheet": "https://docs.google.com/spreadsheets/d/1EZLnhDCfmhGUnlubmGE-WIfFie8KrJnJkKE2w9f-4AQ/edit",
10 "sheetName": "Demo",
11 "keyColumns": ["sku"],
12 "columns": [
13 {
14 "name": "sku",
15 "type": "string",
16 "pattern": "[A-Z]{3}-\\d{3}",
17 },
18 {
19 "name": "qty",
20 "type": "integer",
21 "min": 0,
22 },
23 {
24 "name": "price",
25 "type": "number",
26 "min": 0,
27 },
28 {
29 "name": "active",
30 "type": "boolean",
31 },
32 {
33 "name": "updated",
34 "type": "date",
35 },
36 ],
37 "rows": [
38 {
39 "sku": "ABC-001",
40 "qty": 5,
41 "price": 9.5,
42 "active": True,
43 "updated": "2026-10-21",
44 },
45 {
46 "sku": "ABC-002",
47 "qty": 0,
48 "price": 12,
49 "active": False,
50 "updated": "2026-10-20",
51 },
52 ],
53}
54
55
56run = client.actor("kumo-data-tools/google-sheets-safe-upsert").call(run_input=run_input)
57
58
59print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
60for item in client.dataset(run.default_dataset_id).iterate_items():
61 print(item)
62
63