Take the job sheet a small home-service business actually keeps. One row per job: date, client, service, price, status. It's been typed by three people over two years, on a phone, in a truck, between jobs.
Before you can draw a single chart, you find this:
| Date | Client | Service | Price | Status |
|---|---|---|---|---|
| 2026-09-03 | Acme Property Mgmt | Drain clearing | $185 | Paid |
| 09/04/2026 | ACME property mgmt. | Water heater | 1,240 | Paid |
| Sep 5, 2026 | Harlow, J | Drain clearing | N/A | Quote |
| 8 Sep 2026 | acme property management | Leak repair | $320.00 | Unpaid |
Four date formats, a price column that's sometimes a dollar amount, sometimes a bare number and sometimes "N/A", and one client spelled three ways. Chart it as is and Acme shows up as three small customers instead of your biggest one.
Charts are the easy part. Here's the cleanup.
The four fixes that matter
Most messy sheets need the same four things.
- One date format. Parse every format you find into a real date, then group by week or month.
- Numbers that are numbers. Strip
$and commas. Turn "N/A", "TBD" and blanks into missing, not zero. A zero drags every average down and makes it look like you did free work. - One name per client. Lowercase, trim, drop punctuation, then map the leftovers by hand. Fuzzy matching is tempting, but a ten-line lookup table you can read beats a clever guess you can't check.
- Decide what counts. A quote isn't revenue. Filter on status before you add anything up.
The cleaning script
This uses only Python's standard library. Point it at a CSV export of the sheet.
# clean_jobs.py
import csv
import re
from datetime import datetime
DATE_FORMATS = ["%Y-%m-%d", "%m/%d/%Y", "%b %d, %Y", "%d %b %Y"]
# Map every spelling you've seen to one name. Keys are already normalized.
CLIENTS = {
"acme property mgmt": "Acme Property Management",
"acme property management": "Acme Property Management",
"harlow j": "J. Harlow",
}
def parse_date(text):
text = text.strip()
for fmt in DATE_FORMATS:
try:
return datetime.strptime(text, fmt).date()
except ValueError:
pass
raise ValueError(f"Unknown date format: {text!r}")
def parse_price(text):
cleaned = re.sub(r"[$,\s]", "", text)
if cleaned.upper() in {"", "N/A", "NA", "TBD", "-"}:
return None
return float(cleaned)
def normalize_client(text):
key = re.sub(r"[^a-z0-9 ]", "", text.lower())
key = re.sub(r"\s+", " ", key).strip()
return CLIENTS.get(key, text.strip())
def load(path):
jobs = []
with open(path, newline="") as f:
for row in csv.DictReader(f):
jobs.append({
"date": parse_date(row["Date"]),
"client": normalize_client(row["Client"]),
"service": row["Service"].strip(),
"price": parse_price(row["Price"]),
"status": row["Status"].strip().lower(),
})
return jobs
Two choices in there are deliberate. An unknown date format raises an error instead of being skipped, so a new format announces itself instead of silently dropping jobs. And a client that isn't in the lookup table keeps its original spelling, so a new client still shows up. Run it once, read the list of names it produces, and add any duplicates to CLIENTS.
From clean rows to a dashboard
With clean rows, each chart is a few lines of grouping. On Output Charts, every visual holds one JSON document, so the script's last job is to build those documents.
A horizontal bar for revenue by service, counting only finished work:
{
"orientation": "horizontal",
"mode": "grouped",
"xKey": "service",
"series": [{ "key": "revenue", "label": "Revenue" }],
"data": [
{ "service": "Water heater", "revenue": 18600 },
{ "service": "Leak repair", "revenue": 9450 },
{ "service": "Drain clearing", "revenue": 7215 }
]
}
A line for jobs per week, with quotes alongside so you can see how many turn into work:
{
"xKey": "week",
"curve": "monotone",
"series": [
{ "key": "jobs", "label": "Jobs done" },
{ "key": "quotes", "label": "Quotes sent" }
],
"data": [
{ "week": "Sep 1", "jobs": 11, "quotes": 6 },
{ "week": "Sep 8", "jobs": 14, "quotes": 9 },
{ "week": "Sep 15", "jobs": 12, "quotes": 5 },
{ "week": "Sep 22", "jobs": 16, "quotes": 8 }
]
}
And a table of top clients, which is where the name cleanup pays off:
{
"columns": [
{ "key": "client", "label": "Client", "align": "left", "format": "text" },
{ "key": "jobs", "label": "Jobs", "align": "right", "format": "number" },
{ "key": "revenue", "label": "Revenue", "align": "right", "format": "number" },
{ "key": "unpaid", "label": "Unpaid", "align": "right", "format": "number" }
],
"data": [
{ "client": "Acme Property Management", "jobs": 23, "revenue": 11840, "unpaid": 320 },
{ "client": "J. Harlow", "jobs": 4, "revenue": 1610, "unpaid": 0 },
{ "client": "Northside Dental", "jobs": 3, "revenue": 940, "unpaid": 185 }
]
}
Building the first one from the cleaned jobs looks like this:
from collections import defaultdict
jobs = load("jobs.csv")
done = [j for j in jobs if j["status"] in {"paid", "unpaid"} and j["price"] is not None]
by_service = defaultdict(float)
for j in done:
by_service[j["service"]] += j["price"]
revenue_by_service = {
"orientation": "horizontal",
"mode": "grouped",
"xKey": "service",
"series": [{"key": "revenue", "label": "Revenue"}],
"data": [{"service": s, "revenue": round(v)}
for s, v in sorted(by_service.items(), key=lambda kv: -kv[1])],
}
Print it with json.dumps(revenue_by_service, indent=2) and paste it into the visual's editor. Or, on Solo ($10 a month), push it with one PUT to the visual's push URL using an API key, so the dashboard updates every time the script runs:
import os
import requests
r = requests.put(os.environ["OC_SERVICES_URL"], json=revenue_by_service,
headers={"Authorization": f"Bearer {os.environ['OC_KEY']}"}, timeout=10)
r.raise_for_status()
Copy the push URL from Push from code → Copy push URL in the editor, and create the key under Account → API keys.
The shortcut for a one-off: Format with AI
If you just need this month's chart for a client meeting and won't do it again, writing a script is overkill. Format with AI (part of Solo) takes a messy paste, such as rows copied straight from the sheet, and reshapes it into the JSON that visual needs. You can add a line of instructions to the paste, like "revenue by service, paid and unpaid jobs only, treat N/A as missing".
You see a preview before anything is saved. Read it. It's a language model, so check the totals against the sheet before you confirm, especially where names were merged. It accepts up to 20,000 characters per paste and up to 100 runs a day.
For anything that repeats every week, the script is better: it does the same thing every time, and you can read exactly what it did.
Honest limits
- Ambiguous dates stay ambiguous.
03/09/2026is March 9 or September 3, and no parser can know. Pick the format your sheet's users meant, list it first, and drop any format you don't actually see. - The lookup table needs upkeep. A new spelling shows up as a separate client until you add it. Glancing at the top-clients table once a month catches most of them.
- The dashboard draws what you send. It won't clean the data for you, filter it, or remember last month. Keep your past numbers in the sheet or a file and send the full series each time.
- Size limits. A document can be up to 100 KB, and a table up to 200 rows. Send totals, not every job.
Try it
Export your sheet to CSV, run the cleaner, and look at the client list it prints. That list alone is usually worth the ten minutes. Then create a free dashboard and paste the documents above to see the layout. For pushing on a schedule, see Schedule dashboard updates with cron or GitHub Actions.