Get your API key

Lesson 4 of 5

A weekly HTML and PDF report made by a coding agent

One reusable script that turns this week's CSV into report.html and a PDF, with a totals check printed every run.

9 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson a coding agent will have written one reusable script that turns this week's CSV into a one-page HTML report and a PDF, and checks its own totals every time it runs.

You need: a coding agent set up on your laptop (see the Claude Code, Codex or OpenCode guide), Chrome, your Sheet and KPI dictionary from lessons 1 and 2 · Time: 9 minutes

  1. The Data Studio dashboard is great for people who click. A PDF is better when the report must be attached to an email, kept as a record ("what did we report in week 46?"), read by someone outside your Google account world (a director on Outlook, a franchise partner), or printed for a review meeting.

    Analyse a CSV with an AI agent already showed you the basics: a folder, a plan first, a Python script, checking the numbers. Here you build the weekly version: the same script, run every Monday on fresh data.

    Get the data out of the Sheet the safe way, by downloading it:

    1. Make a folder weekly-mis with a subfolder data.
    2. In the Sheet, open the Sales tab, then File → Download → Comma Separated Values (.csv). Save it as weekly-mis/data/sales.csv.
    3. Do the same for the Targets tab, as data/targets.csv.
    Careful

    Do not use File → Share → Publish to web to give the agent a link to your data. A published sheet can be seen by anyone on the internet who has, or guesses, the link. Downloading a CSV keeps the data on your laptop.

    Why?

    The agent only needs a file on your laptop. Every other route (public links, shared passwords, pasting rows into a chat) puts your company's sales where it should not be.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. Ask for one reusable script
  2. Build the checks into the script
  3. Turn the HTML into a PDF
  4. The Monday routine
  5. Recap