All Articles

How to Use Claude Code to Auto-Generate Weekly Client Performance Reports

April 30, 2026
How to Use Claude Code to Auto-Generate Weekly Client Performance Reports
Adventure Media PPC

Most agency account managers spend somewhere between three and six hours every week doing something that should take twenty minutes: writing client performance reports. They pull numbers from Google Ads, copy them into a spreadsheet, format a slide deck, write a narrative summary, and then do it all over again the following Monday. It is repetitive, error-prone, and frankly beneath the skill level of anyone qualified to actually manage ad campaigns. Claude Code changes this completely. With the right setup, a single script can pull your client data, analyze performance trends, write polished narrative summaries, and export a formatted report, all without a human touching it. This guide walks through exactly how to build that system from scratch, even if you have never written a line of code in your life.

The approach described here is not theoretical. It is a practical, step-by-step workflow that agencies and freelancers are using right now to reclaim hours every week and deliver more consistent, higher-quality reporting than they ever could manually. By the end of this guide, you will have a working Claude Code automation that generates weekly client performance reports on a schedule, with your branding, your analysis framework, and zero manual effort after the initial setup.

⚠ Want to master this faster than any tutorial can teach it?

Adventure Media's hands-on workshop "Master Claude Code in One Day" walks you through live automation builds with expert instructors. Seats are filling fast and the next cohort is nearly full.

Reserve Your Spot Now →

What Is Claude Code and Why It Is the Right Tool for Report Automation

Claude Code is Anthropic's agentic coding environment that lets you direct Claude using plain English to write, run, and iterate on code directly inside your terminal or development environment. Unlike asking Claude a question in a chat interface and then manually copying the output, Claude Code can actually execute tasks, read and write files, call APIs, and chain together complex multi-step workflows. For report automation specifically, that distinction matters enormously.

Traditional automation tools like Zapier or Make are excellent for simple linear workflows: "when X happens, do Y." But generating a performance report is not a linear task. It requires conditional logic (if ROAS dropped more than 20%, flag it as a concern), natural language generation (write a two-paragraph summary of this campaign's performance), and formatting decisions that depend on the data itself. Claude Code handles all three natively because it combines a capable coding engine with a large language model that understands business context.

How Claude Code Differs from Other Automation Approaches

Most reporting automation tools focus on visualization: they pull data and render it in a chart. Claude Code goes further by adding interpretation. It can read a table of numbers and write a sentence like "Click-through rates declined across branded campaigns this week, likely reflecting reduced search volume during the holiday period, though conversion rates held steady suggesting intent quality remained high." That kind of contextual narrative is what clients actually read in a report. Numbers without story are just data.

The other major advantage of Claude Code for beginners is the feedback loop. When you are building your automation and something breaks, you describe the problem in plain English and Claude diagnoses and fixes it. You do not need to google error messages or read Stack Overflow threads. The tool teaches you as it helps you build, which is why the learning curve is dramatically shorter than learning a traditional scripting language from scratch.

What You Will Build in This Guide

By following each step in this tutorial, you will produce a working Python script (generated and debugged by Claude Code) that does the following every Monday morning:

  • Connects to the Google Ads API or a CSV data export from your reporting platform
  • Pulls the previous seven days of campaign performance data for a specified client account
  • Calculates key metrics including impressions, clicks, CTR, conversions, cost per conversion, and ROAS
  • Compares current week performance to the prior week and to a four-week average baseline
  • Generates a narrative summary using Claude's language capabilities, highlighting wins, concerns, and recommended actions
  • Formats the output as a clean HTML or PDF report with your agency's branding
  • Emails the report directly to your client

Each step below covers a discrete phase of the build, including the exact prompts to use with Claude Code, common mistakes to avoid, and how long each phase should take.

Step 1: Set Up Your Claude Code Environment

Estimated time: 20-30 minutes. Prerequisite: A computer running macOS, Windows, or Linux with internet access.

Before you write a single line of automation logic, you need a working Claude Code environment. This step covers the installation process and the initial configuration that will make every subsequent step faster and less error-prone.

Install the Required Tools

Claude Code runs inside your terminal and requires Node.js to be installed on your machine. If you are not sure whether Node.js is installed, open your terminal (on Mac, search for "Terminal" in Spotlight; on Windows, open Command Prompt or PowerShell) and type node --version and press Enter. If you see a version number like v20.11.0, you are good. If you see an error, download and install Node.js from the official Node.js download page before continuing.

Once Node.js is confirmed, install Claude Code by running this command in your terminal:

npm install -g @anthropic-ai/claude-code

After installation completes, run claude --version to confirm it installed correctly. You should see a version number in the output.

Authenticate with Your Anthropic Account

To use Claude Code, you need an Anthropic API key. Log into your account at console.anthropic.com, navigate to the API Keys section, and create a new key. Copy the key immediately because you will not be able to view it again.

In your terminal, set the key as an environment variable. On Mac/Linux:

export ANTHROPIC_API_KEY="your-api-key-here"

On Windows PowerShell:

$env:ANTHROPIC_API_KEY = "your-api-key-here"

For a permanent setup (so you do not have to re-enter this every session), add the export command to your shell profile file. Claude Code will explain how to do this if you ask it: simply type claude to open a session and say "Help me permanently save my API key in my terminal environment."

Create Your Project Directory

Organization matters for automation projects. Create a dedicated folder for your reporting automation:

mkdir client-report-automation && cd client-report-automation

Then launch Claude Code inside this directory:

claude

You are now inside a Claude Code session. From here, every instruction you type will be interpreted by Claude, which can read and write files in your current directory, run code, and install packages. Common mistake to avoid: Do not run Claude Code from your desktop or a non-specific folder. It will create files wherever it is launched, and a cluttered environment leads to confused automation logic later.

Step 2: Define Your Report Structure Before Writing Any Code

Estimated time: 15-20 minutes. Prerequisite: Clarity on which metrics matter most to your specific client.

Skipping this step is the single biggest mistake beginners make with automation projects. They ask Claude Code to "build a report" without defining what that report should contain, and they end up iterating endlessly on formatting instead of building something useful. Spend twenty minutes here and you will save three hours later.

Create a Report Specification Document

Inside your Claude Code session, type the following prompt:

"Create a file called report-spec.md that I will use to define my client report structure. Include sections for: report title and branding, key metrics to include, comparison periods, narrative sections, alert thresholds (what counts as a significant change worth flagging), and output format preferences."

Claude Code will generate this file. Open it in a text editor (the file will appear in your project directory) and fill it in based on your actual client needs. Here is an example of what a completed spec looks like for a mid-size e-commerce advertiser:

Report Section Content Alert Threshold
Executive Summary 2-3 sentence narrative, biggest win, biggest concern N/A
Total Spend Actual vs. pacing target ⚠️ Flag if >15% over or under
ROAS This week vs. last week vs. 4-week avg ⚠️ Flag if drops >20% week-over-week
Conversions Total, by campaign, by device ❌ Flag if zero conversions on any active campaign
CTR by Campaign Sorted by spend, current vs. prior week ⚠️ Flag if drops >25% week-over-week
Top Search Terms Top 10 by conversions, top 5 by cost with no conversion ❌ Flag any term spending >$50 with 0 conversions
Recommended Actions Bulleted list, 3-5 items max N/A

Pro tip: Ask Claude Code to review your completed spec for logical gaps. Type "Read my report-spec.md file and tell me if there are any common reporting use cases I have missed for a paid search client." Claude will often surface things like missing impression share data, quality score trends, or budget pacing alerts that experienced account managers include but newcomers overlook.

Step 3: Connect Your Data Source

Estimated time: 30-45 minutes. Prerequisite: Access to your client's Google Ads account, or a CSV export of their data.

The automation is only as good as the data flowing into it. This step covers two approaches: the simpler CSV-based approach for beginners and the more powerful API-based approach for those ready to go deeper.

Every reporting platform, including Google Ads, Meta Ads Manager, and Microsoft Advertising, allows you to export performance data as a CSV file. The simplest way to start your automation is to have the script process a CSV file that you (or an assistant) export weekly. While this is not fully hands-free, it eliminates the reporting and narrative-writing work, which accounts for the majority of the time spent.

Export a sample week of data from Google Ads by navigating to Reports, selecting a custom date range for the past seven days, and downloading the data as a CSV. Save it in your project directory as weekly-data.csv.

Now prompt Claude Code:

"Read the file weekly-data.csv in my project directory and tell me the column headers. Then write a Python script that reads this file, calculates total spend, total conversions, average CTR, and ROAS (assuming a revenue column exists), and prints a summary to the console."

Claude Code will read the actual file, identify the real column names (which vary depending on how you configured the export), and write a script that works with your specific data structure. This is a significant advantage over following a generic tutorial that assumes column names that may not match yours.

Option B: Google Ads API Integration (Advanced)

For a fully automated weekly run with no manual CSV export, you need to connect directly to the Google Ads API. This requires setting up OAuth credentials in Google Cloud Console, which involves creating a project, enabling the Google Ads API, and generating a client ID and secret.

Rather than reproduce the entire setup process here (which changes regularly), use Claude Code to guide you through it in real time:

"I want to connect to the Google Ads API using Python. Walk me through the credential setup process step by step, then write a script that authenticates and pulls last week's campaign performance data for account ID [your-account-id] including impressions, clicks, cost, conversions, and conversion value."

Claude Code will ask clarifying questions, generate the authentication code, help you troubleshoot any OAuth errors, and write the data-pulling query using Google Ads Query Language (GAQL). Common mistake to avoid: Do not skip the test mode. Before running against a live client account, ask Claude Code to add a "dry run" flag to the script that prints what it would pull without actually making the API call. This saves you from accidentally burning through API quota during debugging.

Validating Your Data Connection

Once your data source is connected (via either method), validate the output before building the report layer on top of it. Prompt Claude Code:

"Run the data script and compare the totals it outputs to the totals I can see in my Google Ads interface. If there are discrepancies, explain what might cause them."

Common discrepancies include time zone differences, conversion attribution window mismatches (your script might pull all-time conversions while the UI shows a 30-day window), and currency rounding. Claude Code will identify these issues and suggest fixes.

Step 4: Build the Narrative Generation Logic

Estimated time: 45-60 minutes. Prerequisite: Working data connection from Step 3.

This is the step that separates a Claude Code report from a standard automated dashboard. The narrative layer takes raw numbers and turns them into the kind of written analysis that clients actually read and find valuable. It is also the step that most clearly demonstrates why Claude Code is the right tool for this specific job.

Designing the Analysis Prompt

The quality of the narrative Claude generates depends entirely on the quality of the prompt you give it. A weak prompt produces generic filler. A strong prompt produces analysis that sounds like it came from a senior account manager who knows the client's business.

Ask Claude Code to create a prompt template file:

"Create a file called narrative-prompt-template.txt that contains the system prompt I will use to generate the narrative section of my weekly report. The prompt should instruct Claude to write in a professional but accessible tone, focus on implications rather than just restating numbers, highlight the most significant change (positive or negative) first, and always end with 2-3 specific actionable recommendations. Include placeholders like [CURRENT_WEEK_ROAS] that my Python script will fill in with real data before sending the prompt."

Review the generated template and customize it to match your agency's voice. Some agencies prefer a more analytical tone; others write reports that read more conversationally. The template is where you encode your agency's reporting style so that every report sounds consistent regardless of which team member runs the script.

Connecting the Data to the Narrative Prompt

The next step is writing the Python code that takes your calculated metrics, inserts them into the prompt template, calls the Anthropic API, and captures the generated narrative. Prompt Claude Code:

"Write a Python function called generate_narrative() that takes a dictionary of calculated metrics as input, reads the narrative-prompt-template.txt file, replaces all the placeholders with actual values from the metrics dictionary, sends the completed prompt to the Anthropic API using the claude-3-5-sonnet model, and returns the generated text. Include error handling in case the API call fails."

Claude Code will write this function. Notice the model specification in the prompt: different Claude models have different strengths. For report narrative generation, the Sonnet model strikes the best balance between quality and cost at scale. If you are generating reports for 20+ clients weekly, model choice has a meaningful impact on your API costs.

Adding Conditional Alert Logic

The alerts you defined in your report spec (Step 2) need to be translated into code that flags unusual data before the narrative is generated. This gives Claude the context it needs to write a narrative that addresses the most important issues, not just the most recent ones.

"Using the alert thresholds from my report-spec.md file, write a Python function called check_alerts() that takes the metrics dictionary and returns a list of alert strings. For example, if ROAS dropped more than 20% week-over-week, it should return the string 'ROAS dropped 23% this week compared to last week, falling below the four-week average.' These alert strings should be appended to the narrative prompt so Claude knows what to prioritize in the analysis."

This pattern, generating structured alert text from data and injecting it into the AI prompt, is one of the most powerful techniques in Claude Code automation. It ensures the narrative is grounded in real data anomalies rather than generating generic commentary about metrics that are all performing normally.

Step 5: Design and Generate the Report Template

Estimated time: 30-40 minutes. Prerequisite: Completed narrative generation function from Step 4.

The report your client receives needs to look professional. A wall of plain text or an unstyled HTML dump will undercut the quality of the analysis inside it. This step builds the visual template that wraps your data and narrative in a polished, branded format.

Choose Your Output Format

The two most practical output formats for client reports are HTML (which can be emailed as an inline email or viewed in a browser) and PDF (which is more formal and easier to archive). For most agencies, HTML is the better starting point because it is easier to style, easier to debug, and works natively in email clients without requiring additional libraries.

Prompt Claude Code to build an HTML template:

"Create an HTML template file called report-template.html for a professional client performance report. Include: a header section with a placeholder for the agency logo and client name, a colored banner showing the report date range, a metrics summary section with cards showing key numbers, a narrative section with clear typography, a data table section for campaign-by-campaign breakdown, an alerts section that only appears if there are alerts to show, and a footer with agency contact information. Use a clean, modern design with a color scheme of dark navy (#1a2744) and white, with red (#e03030) accents for alerts. All data values should use Jinja2 template placeholders like {{ total_spend }}."

Claude Code will generate a complete, styled HTML file. Open it in your browser to preview the layout. If anything looks off, describe the issue in plain English and Claude will adjust the CSS.

Wire the Template to Your Data

With the template built, you need Python code that renders it with real data. Prompt Claude Code:

"Write a Python function called render_report() that uses the Jinja2 library to render report-template.html with the metrics dictionary and the generated narrative text. The function should return the rendered HTML as a string. Also write a function called save_report() that saves the rendered HTML to a file named 'report-[CLIENT_NAME]-[DATE].html' in a reports/ subdirectory."

Test this by running the script with your sample data. The output file should open in a browser and display all your metrics correctly. Common mistake to avoid: Do not hard-code the client name or date in the script. Use variables from the start, even if you are only building for one client now. Adding multi-client support later is much harder if the client name is buried in a string literal on line 47.

Converting to PDF (Optional)

If your clients prefer PDF reports, ask Claude Code to add PDF conversion:

"Add a function to my script that converts the rendered HTML report to a PDF using the weasyprint library. If weasyprint is not installed, the function should print a clear error message explaining how to install it."

PDF conversion from HTML preserves all your styling and is significantly simpler than trying to build a PDF from scratch using a library like ReportLab.

Step 6: Automate the Email Delivery

Estimated time: 20-30 minutes. Prerequisite: Rendered report from Step 5 and SMTP email credentials or a transactional email service API key.

A report that sits in a folder on your laptop is not automation, it is just faster manual work. This step adds the delivery layer that sends the finished report to your client every Monday morning without anyone pressing a button.

Set Up Email Sending

For sending email from Python, you have two main options: using Gmail's SMTP server (simple, free, but limited to 500 emails per day) or using a transactional email service like SendGrid or Mailgun (more reliable at scale, better deliverability). For most agencies sending fewer than 50 reports per week, Gmail SMTP is perfectly adequate.

Prompt Claude Code:

"Write a Python function called send_report_email() that takes the rendered HTML report, a recipient email address, a subject line, and a brief plain-text fallback message as inputs. The function should send the report as an inline HTML email using Gmail SMTP. Store the Gmail username and app password as environment variables called GMAIL_USER and GMAIL_APP_PASSWORD rather than hard-coding them in the script. Include error handling and logging so I can see whether each email sent successfully."

Note the environment variable pattern: never put email credentials directly in your code. Claude Code will enforce this if you ask it to, and it should be a non-negotiable standard for any automation you build that handles client data.

Configure Gmail App Password

If you are using Gmail, you need to generate an App Password rather than using your regular Gmail password. This requires two-factor authentication to be enabled on your Google account. Navigate to your Google Account settings, select Security, then App Passwords, and generate a new password for "Mail" on "Mac" (or your actual device). This 16-character password goes into your GMAIL_APP_PASSWORD environment variable.

Test the Full Send

Before setting up the schedule, run the complete pipeline once end-to-end and send the report to your own email address to verify it looks correct in an email client. Email rendering is notoriously inconsistent, and a report that looks perfect in a browser may have layout issues in Gmail or Outlook. Ask Claude Code:

"Review my report HTML template and identify any CSS properties that are known to render poorly in Gmail or Outlook. Suggest fixes that will make the email display consistently across major email clients."

Step 7: Schedule the Automation to Run Weekly

Estimated time: 20-25 minutes. Prerequisite: Fully tested end-to-end pipeline from Steps 3-6.

The final step is making the automation actually automatic. This means setting up a scheduler that runs your script every Monday morning at a specified time, without any manual trigger.

Using Cron Jobs on Mac/Linux

On Mac and Linux systems, cron is the built-in task scheduler. Prompt Claude Code:

"Write the cron job command I need to run my report automation script every Monday at 7:30 AM local time. The script is located at /Users/myname/client-report-automation/run_report.py and uses Python 3. Also explain how to open my crontab file and add this command."

Claude Code will generate the exact cron syntax (something like 30 7 * * 1 /usr/bin/python3 /path/to/run_report.py >> /path/to/report.log 2>&1) and explain each component. The log redirection at the end is important: it captures any errors from the script run so you can diagnose problems if a report fails to send.

Using Task Scheduler on Windows

On Windows, the equivalent of cron is Task Scheduler. Ask Claude Code to walk you through the setup:

"Give me step-by-step instructions to set up a scheduled task in Windows Task Scheduler that runs my Python report script every Monday at 7:30 AM. The Python executable is at C:\Python311\python.exe and the script is at C:\Users\myname\client-report-automation\run_report.py."

Cloud-Based Scheduling for Always-On Reliability

A significant limitation of running the scheduler on your local machine is that the automation only runs when your computer is on and connected to the internet. For a professional setup, consider moving the script to a cloud server. Ask Claude Code:

"Explain my options for running this Python script on a cloud server on a weekly schedule. Compare running it on a small AWS EC2 instance, using AWS Lambda with EventBridge scheduling, and using a service like PythonAnywhere. Include rough cost estimates for running a script once per week."

For most small agencies, a $5-7 per month virtual server (from providers like DigitalOcean, Linode, or AWS) running Linux with a cron job is the simplest reliable option. AWS Lambda is more cost-efficient at scale but has more complex setup requirements.

📅 Skip the trial and error. Build this live with expert guidance.

The Adventure Media "Master Claude Code in One Day" workshop compresses months of self-directed learning into a single intensive day. You will leave with working automations built for your actual business, not toy examples. This is the fastest path to implementing everything this guide covers.

Register Now, Limited Seats Available →

Step 8: Scale to Multiple Clients

Estimated time: 30-45 minutes. Prerequisite: Single-client pipeline fully working from Steps 3-7.

Once your single-client automation is running reliably, scaling to multiple clients is mostly a configuration exercise. The logic stays the same; what changes is how you store and pass client-specific parameters.

Build a Client Configuration System

Prompt Claude Code:

"Create a JSON configuration file called clients.json that stores the configuration for multiple clients. Each client entry should include: client name, Google Ads account ID, recipient email addresses (as an array to support multiple contacts), monthly budget target, ROAS target, alert thresholds (which can override the defaults), report branding color (hex code), and whether the client wants PDF or HTML delivery. Then modify my main script to loop through all clients in this file and generate a separate report for each one."

This configuration-driven approach is how professional automation systems are built. Adding a new client takes two minutes: add their entry to the JSON file and the next scheduled run will include them automatically.

Add Per-Client Narrative Customization

Different clients have different priorities. An e-commerce client cares most about ROAS and conversion value. A lead generation client cares about cost per lead and lead quality signals. A brand awareness campaign should emphasize impression share and reach metrics. Add a "client_context" field to each client's configuration that describes their business and goals, then inject this into the narrative prompt:

"Update the generate_narrative() function to include the client's business context from their configuration entry in the prompt. For example, if the config says 'e-commerce retailer focused on ROAS above 4.0', the narrative prompt should instruct Claude to evaluate all metrics in that context and prioritize ROAS discussion."

This produces reports that feel custom-written for each client's situation rather than generic performance summaries that could apply to any account. It is one of the most effective ways to use Claude's language capabilities in an automation context, and it is something that hands-on Claude Code workshops spend significant time on because the quality difference is dramatic.

Add a Run Log and Error Reporting

When you are running reports for 10 or 20 clients every Monday, you need a way to know which ones succeeded and which ones failed without checking each email manually. Ask Claude Code:

"Add a logging system to my script that writes a run log to a file called run-log.csv. For each client, log: the client name, the timestamp the report ran, whether it succeeded or failed, the number of alerts generated, and any error message if it failed. Also add a summary email that sends to my internal team address with a table showing the run status for all clients."

This administrative layer transforms your automation from a script into a system. You get visibility into what is running, what is failing, and what might need attention, all without opening individual client reports to check.

Advanced Optimization: Making the Reports Even More Valuable

The steps above produce a working, professional weekly report automation. The techniques in this section take it further, adding capabilities that differentiate your reporting from anything a client could get from a generic dashboard tool.

Add Month-over-Month and Year-over-Year Comparisons

Week-over-week data is valuable for spotting immediate issues, but clients making strategic decisions need longer time horizons. Extend your data pulling to include the equivalent week from the prior month and the equivalent week from the prior year (if data is available). This requires storing historical data in a simple database or flat file structure so the script can reference past periods without re-querying the API.

Ask Claude Code: "Design a simple SQLite database schema for storing weekly report data by client and week. Then write functions to save the current week's data after each run and query historical data for comparison periods."

Incorporate External Context

One of the most impressive things Claude can do in report narratives is acknowledge external factors that affected performance. If your client's CTR dropped during a week when a major competitor ran a TV campaign, or when a seasonal shopping pattern shifted demand, the narrative should mention this. You can feed external context into the prompt:

Add a "weekly_notes" field to your client configuration that you (or an assistant) update each week with relevant external context: "Black Friday week, client extended to 24/7 bidding," or "Competitor launched new product, increased their ad spend significantly." Claude will incorporate these notes into the narrative analysis, making the report feel like it was written by someone who actually understands the client's market.

Add Anomaly Detection

Beyond the threshold-based alerts you set up in Step 2, statistical anomaly detection can catch unexpected patterns that fixed thresholds miss. Ask Claude Code to implement a simple statistical model:

"Using the historical data in my SQLite database, write a function that calculates the rolling average and standard deviation for each key metric over the past eight weeks. Flag any current week metric that is more than two standard deviations from the mean as a statistical anomaly. Add these anomaly flags to the alert list that gets injected into the narrative prompt."

This kind of analysis is what data scientists charge significant consulting fees to implement. With Claude Code, it is a twenty-minute addition to an existing script.

Frequently Asked Questions

Do I need to know how to code to use Claude Code for report automation?

No prior coding experience is required, but basic familiarity with using a terminal (command line) will help. Claude Code generates all the Python code for you based on your plain-English descriptions. You do need to be comfortable running commands in a terminal and editing configuration files. If you have never opened a terminal before, plan an extra hour for initial setup and orientation.

How much does it cost to run this automation?

The main costs are your Anthropic API usage for generating narratives and your infrastructure for running the scheduler. Narrative generation for a single detailed client report typically uses a modest amount of tokens, making per-report costs generally very low through the API. A cloud server for scheduling runs roughly $5-7 per month. For an agency running 20 client reports weekly, total monthly costs are typically well under $50 depending on report complexity and narrative length.

Can this work with platforms other than Google Ads?

Yes. The architecture described here is platform-agnostic. Meta Ads, Microsoft Advertising, LinkedIn Ads, and most other platforms offer either a CSV export or an API. The data-pulling step (Step 3) is the only part that changes between platforms. The narrative generation, report template, email delivery, and scheduling steps are identical regardless of your data source.

What happens if the API call to Claude fails during a scheduled run?

The error handling added in Step 4 and the logging system from Step 8 cover this scenario. When the Anthropic API call fails, the script catches the exception, logs the error to the run log, and sends an internal alert to your team. The report for that client is skipped rather than sending a broken or empty report. You can then manually re-run that specific client's report once the issue is resolved.

Is client data safe when sending it to the Anthropic API?

This is an important question that every agency should evaluate carefully. Anthropic's API terms and privacy policy govern how data submitted to the API is handled. For reports containing sensitive client financial data, review Anthropic's privacy policy and your client contracts to ensure compliance. Many agencies choose to send aggregated metrics (numbers only, no personally identifiable information) to the API for narrative generation, rather than raw query-level data. This significantly reduces any data sensitivity concerns while still enabling the full narrative generation capability.

How do I handle clients who want reports in different formats?

The client configuration system from Step 8 handles this. Add a "report_format" field to each client's JSON configuration with a value of either "html" or "pdf". The main script reads this field and calls either the HTML delivery function or the PDF conversion function accordingly. Some clients may want both, in which case set the value to "both" and add conditional logic that generates and sends both formats.

Can the report include charts and graphs?

Yes, though it adds complexity to the build. Python's matplotlib or plotly libraries can generate charts from your metric data and embed them in the HTML report as base64-encoded images. Ask Claude Code: "Add a function that generates a bar chart comparing this week's campaign ROAS values and embeds it as a base64 image in the report HTML." Chart generation is typically added after the core pipeline is working and tested, not during initial setup.

What if my client's data structure changes (e.g., they add new campaigns)?

Because the script reads column names dynamically from the CSV or API response rather than assuming a fixed structure, new campaigns appear automatically in the next run without any code changes. The configuration-based approach means the only thing that might need updating is the budget target in the client's JSON config if they launch a new campaign with a separate budget.

How long does the full setup take from start to finish?

For someone who has never used Claude Code before, following this guide end-to-end takes roughly four to six hours for a single-client setup. Multi-client scaling adds another one to two hours. Subsequent clients take under thirty minutes each once the system is built. The Adventure Media workshop compresses this timeline significantly by providing pre-built templates, live troubleshooting support, and a structured environment that eliminates the dead ends that slow down self-directed learning.

Can I use this for social media performance reports, not just paid search?

Absolutely. The framework is the same. The data source changes (use the Meta Graph API or LinkedIn Marketing API instead of Google Ads), the metrics in your report spec change (reach, engagement rate, video completion rate instead of CTR and ROAS), and the narrative prompt template changes to reflect social media performance context. The narrative generation, templating, email delivery, and scheduling layers are identical.

What is the biggest mistake agencies make when first setting up this automation?

Trying to build everything at once before testing any individual component. The most reliable approach is to build and test each step in isolation before connecting it to the next one. Confirm your data pulls are accurate before building the narrative layer. Confirm the narrative generates correctly before building the email layer. Confirm the email sends correctly before setting up the scheduler. Claude Code makes it tempting to ask for the entire system in one prompt, but incremental testing catches errors when they are easy to fix rather than when they are buried in a complex multi-step pipeline.

How do I keep the automation running if my laptop is off?

Move the scheduler to a cloud server as described in Step 7. A $5-7 per month virtual private server (VPS) from providers like DigitalOcean, Vultr, or AWS Lightsail runs Linux 24/7 and supports cron scheduling. Upload your script, configure your environment variables, and set up the cron job. Your reports will generate and send every Monday morning whether your laptop is open or not.

Key Takeaways

  • Claude Code is not just a code generator, it is an agentic environment that reads files, runs code, diagnoses errors, and iterates on your behalf, making it uniquely suited for complex automation projects like report generation.
  • The report specification document (Step 2) is the highest-leverage step in the entire process. Agencies that skip it spend three times as long on formatting iterations that could have been avoided.
  • The narrative generation layer is what makes this automation genuinely valuable to clients. Raw data tables could come from any dashboard tool. Contextual, client-specific written analysis is what justifies your agency's fee and builds client confidence.
  • Start with CSV-based data input and move to API integration once the rest of the pipeline is working. The API connection is the most technically complex part, and it is easier to debug in isolation.
  • Store credentials as environment variables, never in code. This protects client data and makes it safe to share or version-control your script.
  • The multi-client configuration system (Step 8) is what transforms a one-off script into a scalable agency asset. Build it from the start, even if you only have one client to begin with.
  • Cloud scheduling is the difference between automation and semi-automation. A report that requires someone to press a button is not saving the time you need to save.
  • The fastest path to a working system is a structured learning environment with live expert support. Self-directed tutorials cover the concepts; hands-on workshops like the Adventure Media Claude Code intensive produce working automations you actually deploy.

Join our Claude Code events

Learn more →

Request A Marketing Proposal

We'll get back to you within a day to schedule a quick strategy call. We can also communicate over email if that's easier for you.

Visit Us

New York
1074 Broadway
Woodmere, NY

Philadelphia
1429 Walnut Street
Philadelphia, PA

Florida
433 Plaza Real
Boca Raton, FL

General Inquiries

info@adventureppc.com
(516) 218-3722

AdVenture Education

Over 300,000 marketers from around the world have leveled up their skillset with AdVenture premium and free resources. Whether you're a CMO or a new student of digital marketing, there's something here for you.

OUR BOOK

We wrote the #1 bestselling book on performance advertising

Named one of the most important advertising books of all time.

buy on amazon
join or die bookjoin or die bookjoin or die book
OUR EVENT

DOLAH '24.
Stream Now
.

Over ten hours of lectures and workshops from our DOLAH Conference, themed: "Marketing Solutions for the AI Revolution"

check out dolah
city scape

The AdVenture Academy

Resources, guides, and courses for digital marketers, CMOs, and students. Brought to you by the agency chosen by Google to train Google's top Premier Partner Agencies.

Bundles & All Access Pass

Over 100 hours of video training and 60+ downloadable resources

Adventure resources imageview bundles →

Downloadable Guides

60+ resources, calculators, and templates to up your game.

adventure academic resourcesview guides →