Manual client reporting is not a reporting problem. It is a systems problem masquerading as a communication process. The analyst who spends 15 hours per week pulling data, formatting tables, updating charts, and emailing PDFs is not doing reporting — they are doing data plumbing. The fix is an ETL pipeline that does the plumbing automatically.
The Four-Stage Architecture
- Extract: Pull data from source systems (database queries, API calls, spreadsheet reads) on a schedule. Watermark-based incremental extraction ensures only new rows are pulled on each run, keeping jobs fast regardless of table size.
- Transform: Apply business logic in Python — roll up metrics, compute period-over-period changes, flag anomalies, format numbers. This layer is where analysis lives; it is fully testable and auditable.
- Load: Write transformed data to a Google Sheet via the Sheets API. The sheet is pre-formatted with client branding, chart definitions, and conditional formatting — it updates in-place.
- Deliver: Trigger a PDF export of the sheet via the Drive API and send via Gmail API with a personalized message. The entire cycle runs unattended.
import gspread
from google.oauth2.service_account import Credentials
def update_client_report(client_id, data):
creds = Credentials.from_service_account_file('service_account.json',
scopes=['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive'])
gc = gspread.authorize(creds)
sh = gc.open_by_key(CLIENT_SHEETS[client_id])
sh.worksheet('Data').update('A2', data)
Top comments (0)