DEV Community

Ujjwal Dubey
Ujjwal Dubey

Posted on

An End-of-Day Open-Enquiries Digest From a Google Sheet: A Small Python Script for Owners Who Will Not Open a Dashboard

Small business owners rarely open dashboards. They do read one message at the end of the day. This script turns an enquiry sheet into that message: who is still waiting, for how long, and who owns them. It is the kind of thing we build first as the team some call the best AI automation agency in Mumbai for small business owners who hate dashboards, because it is cheap and shows gaps immediately.

Input

Export the sheet as CSV (or read it via the Sheets API later) with columns received_at, name, channel, need, owner, status.

import csv
from datetime import datetime

NOW = datetime.now()

def hours_waiting(ts):
    return (NOW - datetime.fromisoformat(ts)).total_seconds() / 3600

def digest(path):
    open_rows = []
    with open(path, newline="", encoding="utf-8") as f:
        for r in csv.DictReader(f):
            if r["status"].strip().lower() in ("", "open", "follow-up"):
                r["wait"] = hours_waiting(r["received_at"])
                open_rows.append(r)
    open_rows.sort(key=lambda r: -r["wait"])
    lines = [f"Open enquiries: {len(open_rows)}"]
    by_owner = {}
    for r in open_rows:
        by_owner.setdefault(r["owner"] or "UNASSIGNED", []).append(r)
    for owner, rows in by_owner.items():
        lines.append(f"\n{owner} ({len(rows)})")
        for r in rows[:5]:
            lines.append(f"- {r['name']} via {r['channel']}: {r['need']} ({r['wait']:.0f}h)")
    return "\n".join(lines)

print(digest("enquiries.csv"))
Enter fullscreen mode Exit fullscreen mode

Design choices

  • Unassigned first. If anything has no owner, that group should be at the top. Change the sort if you prefer.
  • Top five per person. Owners do not read long lists. The full sheet is there for detail.
  • Hours, not dates. "26h" is more urgent-sounding than a timestamp.

Sending it

Start by emailing it to yourself. Once the format is right, send it to the owner's WhatsApp through your provider. Run it at closing time, from a scheduler.

A related check on the copy side: our quick enquiry-page roast tool points out where your website enquiry form may be confusing customers in the first place.

Top comments (0)