The site audit: filter, sort, CSV

Produce a stale-content report your team can open in Excel — one script, no clicking through the UI, re-runnable every Monday.

intermediate8 min1 step

Why it matters

This is the payoff of the route: every piece — server-side filter, server-side sort, lazy pagination — composes into the script Tableau admins actually get asked for. "What hasn't been touched since the cutoff, who owns it, where does it live" is the first question of every cleanup, migration, and license review; from here it is one cron entry away from being a standing report. Every other route on this wall reuses this exact shape: query precisely, walk lazily, write the answer somewhere humans look.

Prompt Recipe

Write a Python script using tableauserverclient that signs in with a Personal Access Token from environment variables (TABLEAU_SERVER_URL, TABLEAU_TOKEN_NAME, TABLEAU_TOKEN_VALUE, TABLEAU_SITE_ID) and writes stale-workbooks.csv: every workbook not updated since a cutoff date passed as the first command-line argument (RFC 3339, e.g. 2025-07-01T00:00:00Z), filtered server-side with updated_at__lte and sorted oldest-first with order_by("updated_at"). Columns: name, project, owner id, last updated, and the workbook's web URL. Print a one-line summary with the count and the output path when done, and exit nonzero with a friendly message if any environment variable is missing.

Read it as the route in miniature: the filter asks the precise question, the sort puts the oldest offenders on top, the lazy walk handles a site of any size, and csv.writer ships the answer to the people who will act on it.

Swap the endpoint and the filter and this same skeleton is a dormant-user report, an unrefreshed-extract report, or an untagged-content report — which is exactly why every other route on this wall points back here.

python
.py
Needs your Tableau site

Got what you came for? Mark the stop and the line fills in beneath you.