# Daily Ticket-Count Automation: Gmail PDFs to BigQuery and Google Sheets

> A Python job that reads daily Ticketmaster audit PDFs from email, stores every figure in BigQuery and publishes a Google Sheet that mirrors the team’s existing workbook.

Section: Python Automation

Page: https://showcase.growlyze.cloud/case/python-ticket-count-automation-gmail-bigquery-sheets

## The Problem

An events company received daily Ticketmaster audit PDFs by email and re-typed the figures into a workbook by hand.

## The Solution

A daily job reads the report emails through the Gmail API (with an OAuth refresh token), downloads and parses the audit PDFs, stores every figure in BigQuery, and publishes a Google Sheet that mirrors the team’s existing workbook. It was built spec first: a design spec, then an implementation plan, then tests with fixture PDFs, then the pipeline.

Image: The project repository, with the ticket-count source code, tests, scripts and design documents. (https://showcase.growlyze.cloud/case-content/ticket-count-automation/image1.png)

Image: The Google Sheet the job publishes: tickets sold per day against capacity, split into GA and VIP, with the percentage sold. Event names and some tab names are hidden. (https://showcase.growlyze.cloud/case-content/ticket-count-automation/image2.png)

Image: The Run Log tab, with one row for each run of the job and its time. (https://showcase.growlyze.cloud/case-content/ticket-count-automation/image3.png)

**Built with**

Python, the Gmail API (OAuth), PDF parsing, BigQuery, the Google Sheets API and pytest.
