How to Export All Your Search Console Data With Python

Go beyond Search Console's 1,000-row export: set up API credentials, run a Python script that pages through every query and page by day, and understand the data's limits.

Search Console’s interface exports at most 1,000 rows per table, which hides most queries and pages on any site of real size. The Search Console API returns up to 25,000 rows per request and can be paged through with a start row, so a short Python script can export every query and page combination by day into a CSV file. For very large sites, Search Console’s bulk export to BigQuery removes the limits entirely. This guide covers setup, the script and what the data can and cannot tell you.

Interface, API or bulk export?

Method Rows Best for
Search Console interface export Up to 1,000 per table Quick checks
Search Console API Up to 25,000 per request, paged with startRow Regular exports for most sites
Bulk data export to BigQuery All data, daily, from the day it is set up Large sites and long-term storage

Search Console keeps 16 months of performance data. Exporting regularly keeps your history beyond that.

Step 1: create credentials

  1. In Google Cloud Console, create a project and enable the Google Search Console API.
  2. Create a service account and download its JSON key. Keep this file private.
  3. In Search Console, open Settings, Users and permissions, and add the service account’s email address as a user with restricted access.
  4. Install the client library: pip install google-api-python-client google-auth

Step 2: the export script

#!/usr/bin/env python3
"""Export Search Console performance data (query, page, date) to CSV."""
import csv
from google.oauth2 import service_account
from googleapiclient.discovery import build

SITE = "sc-domain:example.com"          # or "https://www.example.com/"
KEY_FILE = "service-account.json"
START, END = "2026-06-01", "2026-08-31"
ROW_LIMIT = 25000

creds = service_account.Credentials.from_service_account_file(
    KEY_FILE, scopes=["https://www.googleapis.com/auth/webmasters.readonly"])
service = build("searchconsole", "v1", credentials=creds)

rows, start_row = [], 0
while True:
    body = {
        "startDate": START, "endDate": END,
        "dimensions": ["date", "query", "page"],
        "rowLimit": ROW_LIMIT, "startRow": start_row,
        "type": "web",
    }
    resp = service.searchanalytics().query(siteUrl=SITE, body=body).execute()
    batch = resp.get("rows", [])
    rows.extend(batch)
    if len(batch) < ROW_LIMIT:
        break
    start_row += ROW_LIMIT

with open("gsc_export.csv", "w", newline="", encoding="utf-8") as f:
    w = csv.writer(f)
    w.writerow(["date", "query", "page", "clicks", "impressions", "ctr", "position"])
    for r in rows:
        w.writerow(r["keys"] + [r["clicks"], r["impressions"], round(r["ctr"], 4), round(r["position"], 2)])

print(f"Exported {len(rows)} rows")

Use “sc-domain:example.com” for a domain property, or the full URL with a trailing slash for a URL-prefix property, exactly as the property appears in Search Console.

Step 3: understand the limits

  • Anonymised queries: Search Console omits very rare queries to protect privacy, so query-level rows add up to less than the site total.
  • Data freshness: recent days may be incomplete; export complete days and re-export the last few days later.
  • Row totals: grouping by date, query and page produces many rows. For long periods, export month by month.
  • Quotas: the API has usage limits; for large exports, add a short pause between requests.

What to do with the data

Bulk export to BigQuery

Since 2023, Search Console can export performance data daily to a BigQuery dataset you own. Set it up under Settings, Bulk data export. It does not backfill past data, so start it early, and note that BigQuery storage and queries may incur costs.

Frequently asked questions

Can I export Search Console data without code?

Looker Studio’s Search Console connector and Google Sheets add-ons can pull more than the interface allows. The API gives the most control.

Does the API include AI Overviews or AI Mode data separately?

Google has said AI Mode activity is counted in the Performance report totals. The standard API does not separate it by query.

Is the service account key safe to share with a developer?

Treat it like a password. Give read-only Search Console access, store it outside code repositories, and rotate it if it is exposed.

Sources

  1. Google Search Console API documentation, searchanalytics.query
  2. Google Search Central blog, bulk data export announcement, February 2023
  3. Search Console Help, “Performance report” data limits