PDF Report Automation with Python

In this post, I’ll explain how I use Python for PDF report automation to generate data analysis and consulting insights for performance of marketing channels—namely Google, Meta, and Amazon.

Some reasons to use Python for reporting:

  • Remove the need for a consultant or analyst to review performance
  • Make data easy-to-understand for executives:
    • No spreadsheets
    • Automated executive perspectives.
    • No learning curve to use reports.
  • Easy to share over email
    • Small file sizes
    • Internet access not required (aside from sending the email)
  • Professional and on-brand
    • Dynamically change logos
    • Dynamically change fonts
    • Company letterheads
    • Not a spreadsheet.
  • Dynamic functionality
    • Month to Date vs Last Month Repors
    • Only include data for channels that are being used
    • Loop through client accounts

Automated PDF Reports

Here are my automated pdf reports:

Month to Date Report

Last Month Reports

Why I Automate PDF Reports for Marketing

I automate PDF reports because reporting is time consuming, prone to errors, confusing, and boring.

I don’t enjoy making reports, but I recognize that it’s still critical to show improvements to businesses’ bottom line. From an agency perspective, it’s the honest, transparent thing to do.

Business owners need to understand which marketing channels are profitable and whether their bottom-line and engagement is improving.


When I started sharing these reports, I noticed clients immediately starting to ask better questions.

Metrics like 3% CTR or 4.1 ROAS really didn’t mean anything to clients who didn’t have a frame of reference or any experience optimizing for marketing metrics. However, thanks to AI, these metrics are clearly explained in the report. While this puts my work under a microscope, it creates more transparency for clients to understand improvements.

In some cases, this seemed like the first time business owners actually understood what the data meant. And because I try to be transparent in my reporting, clients are seeing all data, not just the data that makes me look good—the ‘happy data’.

My bot is instructed to provide insights based on competitive benchmarks like Advertising Cost of Sale (ACOS) and higher-funnel benchmarks like Click Through Rate (CTR.) Additionally, using API’s, I process total revenue data from their stores to measure their total ACOS in order to get a very honest view of their marketing operations.

morality & the dangers of chat bots

I believe that I created my chat bot to be honest, even if it doesn’t make me look good. My chatbot is told to ‘be positive’, however it is still required to provide insights based on the benchmarks I specified. It still receives all data, and shares data, even if it is not happy data.

It’s important to note that it could be instructed to interpret the data in other ways. It could be instructed to be brutally honest or could be instructed to deceptive. I could say ‘convince the client that their marketing operations are positive under any circumstance,’ ‘use manipulation,’ or even worse, ‘provide your response in haikus.’

Truth is important to me, though one could argue that ‘be positive’ is a deceptive…I guess morality is a spectrum. Especially in the business world. At the end of the day, chat bots, like humans, may or may not have a moral compass at all.

Maybe in the near future, we’ll have truthy chatbots to analyze information for deception to protect us…but I digress. Actually, that’s a pretty good business idea…

Why I don’t hide low performance.

Low marketing ROI is not always because of the quality of marketing. Especially with eCommerce and lower average order values, there are other reasons performance would not be high. Factors like shipping speed and cost, design and quality, and competitive forces are always at play.

I personally believe that marketing will only work if a business works. There is no magic button or lever to get rich. Otherwise, I would press/pull it and move to a big house on the west coast. Marketing is very important, it’s not the sole reason a business should succeed.

As all entrepreneurs must remember, most businesses fail.

As Elon Musk bluntly said:

“One of the biggest traps for smart engineers is optimizing something that shouldn’t exist.”

Elon Musk, Forbes probably quoting some interview on Youtube.

Tech & Business Perspective

Free Template at Github

If you’re reading this as a developer or engineer interested in creating your own reports, check out a prototypes at my Github here: github.com/appaloosa-marketing/ai-pdf-reports/tree/master#readme

It’s a beginner to intermediate project based on the following concept:

  • Pandas for processing
  • chatGPT bots for analyzing data
  • HTML and CSS for report design
    • Dynamically inserting dataframes, graphs, and insights
  • *Weasyprint for PDF creationg

*For mac users, Weasyprint requires Homebrew. Here’s a tutorial on how I configured Homebrew on Mac & Pycharm.

I didn’t want to give away all of my work online, however feel free to reach out if you want to learn more or have questions.

openAI API

Using openAI’s API for chatGPT was a massive breakthrough for my project. It allowed me to summarize data in an intelligent way, which helps make reports easier-to-understand for not just clients, but for me!

openAI has replaced the need for me to hire a marketing assistant to do the grunt work. This allows me to review the reports with more objectivity (since I didn’t write them,) and focus on the bigger picture.

This is obviously great for me! Not so great for entry-level marketers, but that’s for another blogpost… 🙁

Note: I still read them before emailing. I provide a sentence or two of insights if necessary, but so far chatGPT does a great job explaining the data. Since, in relation to my company goals—company goals which are included in the API call! Very cool.

Dynamic HTML

Python and HTML are a powerful combo. I use HTML a lot for SEO and website edits, but never to generate content dynamically.

Additionally, I was surprised how easy it was to dynamically apply CSS styles. For ex, change color to red if value < 0 else green if value > 0. Pretty cool!


Initial Failures and Waste of Time Meetings

Before Python, I would download & format csv/excel files from ad platforms (namely Google, Meta, and Amazon), then have to copy and paste them into powerpoints to explain the data.

In my humble opinion, the whole powerpoint meeting thing is often a big ol’ waste of time. Scheduling and preparing for a 30-60 min meeting which ends in about 5 minutes drove me crazy. This is a good idea if you’re an agency or consultant charging for your time, but is pretty awful for everyone else involved.

Once I became a freelancer, I dedicated my free time to avoiding these types of meetings at all costs.

First, I automated spreadsheets, but still spent the majority of time analyzing and commenting on the reports.

Next, I created data dashboards with multiple pages, which was a bigger failure. There were constant errors with accessing the URL, I couldn’t send the dashboards over email, and the reports themselves were not easy-to-understand for anyone but me.

I blamed myself, and decided to try the pdf report method. Migrating to pdf was actually not that hard, and while working on the project, a cool thing came out called chatGPT. So within a month or two, I finished the project, and was able to add the AI insights which ultimately became the most useful and interesting part of the project. Yup!


You hopefully now understand the impact, utility, and dangers of automating marketing/business reports with Python and openAI.

Now, go forth, and automate .pdf’s. Or pay someone to do it. Or turn off your computer and live off the grid.

The end.

a pony graphic for my automated pdf report blogpost. How i use python and AI to automate business reports.
Appaloosa horse with a coffee, generated with Midjourney
Click to read the welcome letter!


I’m Michael, a Manhattan-based marketer from Texas.

I work with businesses to improve their revenue & ROI/ROAS online.

My experience includes ~3 years at agencies as an SEO / Ad manager, launching my own successful products online (100+ 5-star reviews on Amazon & #1 rankings on Google & Amazon in under a year!) and entry-level/intern work at production studios, a radio station, and a movie-marketing company.

* I’ve been freelancing full-time since January 2023.

I am strictly compliant with platform policies, stay up-to-date with industry changes, and am familiar with dozens of tools to improve & simplify marketing operations. Additionally, I use automation and AI in-house to analyze data and improve performance.

If you’re interested in talking, feel free to reach out! You can use the buttons below to contact.

Thanks for taking the time to read! I appreciate it.







Leave a Reply

Your email address will not be published. Required fields are marked *