DEV Community

Alex Wu
Alex Wu

Posted on

How We Automated a Local Retailer's Weekly Inventory Report in Under 2 Hours

Most SMB automation advice sounds like it's written for a Fortune 500. In practice, small business owners don't have DevOps teams. They have spreadsheets, a WhatsApp group, and a cousin who "does computers."

At Anythoughts.ai, we've been building AI-driven workflows for small and mid-sized businesses. Here's a real workflow we deployed for a local retailer — end to end, including the messy parts.

The problem

A retail client was spending 3–4 hours every Monday manually pulling sales data from their POS system, pasting it into Google Sheets, and writing a summary email to their two-person management team. Same thing. Every week.

They asked if we could "make it faster."

Step 1: Map what's actually happening

Before writing a single line of code, we sat down and mapped the workflow:

  1. Export CSV from POS (manual, ~10 minutes)
  2. Open Google Sheets, paste data, format table (~30 minutes)
  3. Write a short summary by eyeballing the numbers (~60 minutes)
  4. Email it to two people (~5 minutes)

Total: ~1.5–2 hours, repeated 52 times a year. That's over 100 hours annually for a task that produces the same format every week.

Step 2: Identify what needs a human vs. what doesn't

This is the most underrated step. Automation fails when people try to automate judgment. The hard truth:

  • Export CSV → can be scheduled or triggered automatically
  • Format table → fully automatable
  • Write summary → LLM can draft it; human reviews in 2 minutes
  • Send email → fully automatable

We kept one human checkpoint: the store owner reviews the AI-drafted summary before it sends. That takes about 90 seconds.

Step 3: Build the pipeline

We used a simple stack: Google Apps Script (free, already in their ecosystem) + a small OpenAI API call.

// Triggered every Monday at 8 AM
function weeklyInventoryReport() {
  const sheet = SpreadsheetApp.openById(SHEET_ID);
  const data = sheet.getSheetByName('Sales').getDataRange().getValues();

  // Build summary prompt
  const rows = data.slice(1).map(r => `${r[0]}: ${r[1]} units, $${r[2]}`).join('\n');
  const prompt = `You are a retail analyst. Summarize this week's sales data in 3 bullet points for the store owner. Be specific. Flag anything unusual.\n\n${rows}`;

  // Call OpenAI
  const response = callOpenAI(prompt);

  // Draft email (doesn't send yet — owner approves)
  GmailApp.createDraft(
    OWNER_EMAIL,
    'Weekly Sales Summary – ' + new Date().toDateString(),
    response
  );
}
Enter fullscreen mode Exit fullscreen mode

The POS export was trickier — their system only supported manual CSV downloads. We set up a simple Google Form the cashier fills in daily (30 seconds of data entry vs. the old 10-minute weekly export). The form feeds directly into the spreadsheet.

Step 4: Handle the edge cases upfront

Every automation breaks eventually. We built in three simple guardrails:

  1. Empty data check — if the sheet has fewer than 5 rows, skip the run and send a Slack ping
  2. Hallucination guard — the prompt explicitly says "only reference data I've provided, do not invent numbers"
  3. Manual override — the owner can reply to the draft email with "skip" and it won't send that week

Results after 8 weeks

  • Weekly time saved: ~1.5 hours
  • Cost: ~$0.04/week in OpenAI API calls
  • Owner feedback: "It's actually better than what I wrote — it catches things I'd miss"

The last point is interesting. The AI consistently flagged SKUs with declining week-over-week velocity, something the owner admitted she'd eyeball but rarely acted on.

The pattern that works

When we look across the SMB automations we've shipped, the ones that stick share a few traits:

  • They replace repetitive judgment, not all judgment — humans stay in the loop for anything with real stakes
  • They live in tools the business already uses — Google Workspace, WhatsApp, Slack, not new platforms
  • They fail loudly — no silent errors; if something goes wrong, a human hears about it
  • The ROI is obvious — 100+ hours/year saved, ~$2/year in API costs

If you're building automations for SMBs (or for yourself), start with the thing that happens on a fixed schedule and always looks the same. That's your first win.


Building AI workflows for small businesses at Anythoughts.ai. We're sharing what works — and what doesn't — as we go.

Top comments (0)