Connect Google Search Console to PostgreSQL
Import Search Analytics — clicks, impressions, CTR and average position — broken down by query, page, country or device, for your verified sites.
What you can pull from Google Search Console
Google Search Console exposes 5 objects you can pull, each as its own job. Every run pulls the records into a flat table, so nested fields arrive as ordinary columns that PostgreSQL can sort, filter and total without further work.
Top queries
Search queries by day. The most common SEO report.
| Column | Type | Notes |
|---|---|---|
| date | dimension | — |
| query | dimension | — |
| clicks | metric | Always returned |
| impressions | metric | Always returned |
| ctr | metric | A fraction, not a percentage |
| position | metric | Average position |
Top pages
Landing pages by day, with the same four metrics.
By country
Search performance split by country.
By device
Desktop, mobile and tablet split.
Daily totals
One row per day, no breakdown.
Options you can set
- site_url
- A DNS-verified property uses the sc-domain: form, not the https:// URL
- date_range
- yesterday, last_7_days, last_28_days, last_90_days or custom
How it lands in PostgreSQL
PostgreSQL accepts append, replace, upsert writes. Upsert is the one that matters on a schedule: it merges on a key you choose, so matching rows are updated in place and only genuinely new records are created. Append instead, and a daily job multiplies your data.
Upsert uses key_columns as the conflict target.
- Rows are written in chunks of 1,000 by default, configurable up to 50,000.
- Replace truncates the target table before writing.
Authentication
You connect Google Search Console once through OAuth and the credential is stored server-side, never pasted into a cell or a formula. Only the scopes the connector actually calls are requested — the table below lists each one and what it is for.
What Google Search Console is asked for
- webmasters.readonly non-sensitive
- Read search performance. Read-only
- userinfo.email non-sensitive
- Label the connection
Keeping runs incremental
Yes. Pull a rolling date window and append, building history past the 16 months Search Console retains.
Pair a narrowed read with an upsert write and a re-run costs almost nothing: the rows it already knows are updated, and nothing is duplicated. That combination is what makes a frequent schedule affordable.
Limits and pacing
These are the provider-side ceilings that shape a schedule, not ours. Knowing them up front is the difference between a job that runs quietly every morning and one that starts failing the week your data grows.
| Limit | Value | Applies to |
|---|---|---|
| Data retention Google deletes beyond this. There is no upgrade that recovers it. | 16 months | Google Search Console |
| Reporting lag The most recent days are incomplete until Google finishes processing. | 2-3 days | Google Search Console |
Common gotchas
Most of what goes wrong with a scheduled sync is not a bug — it is a detail of how one side behaves that nobody wrote down. These are the ones that come up for this pair.
Clicks, impressions, CTR and position are always returned
Search Console has no selectable metrics - the four come back on every report and cannot be chosen.
Every preset includes the date dimension
Without it the API collapses the whole window into a single aggregated row, which is meaningless appended to a sheet on a daily schedule.
Search Console keeps 16 months
Older data is gone permanently - there is no upgrade that recovers it. Appending to a destination on a schedule is how you keep a longer history.
Set either table or query, never both
The config rejects both being set, and rejects neither - caught when the job is saved rather than on its first run.
Set it up in four steps
- 1
Connect Google Search Console
Connect your Google account, then choose a verified property.
- 2
Connect PostgreSQL
Host, port, database, user and password, stored encrypted.
- 3
Shape the data
Select the columns you want, filter rows, cast types and add computed fields. Everything else is dropped before it reaches the destination.
- 4
Schedule it
Run once, or on a cron. Every run refreshes PostgreSQL with the latest Google Search Console data.
Do I need an add-on or extension for this?
No. The job runs server-side and writes into PostgreSQL through its API, so there is nothing installed in the destination itself. It keeps running when nobody has the file open, and a copy of the file does not need anything installed to work.
How often does the data refresh?
On whatever schedule you set with a cron expression — hourly, daily, or a specific time on specific days. Each run pulls the latest from Google Search Console.
Do I need to write any code?
No. You connect both sides, map the fields in a wizard and set a schedule. Computed fields accept small expressions — abs, round, min, max, len — but there is nothing to host or maintain.
Can I get more than the 1,000 rows the UI exports?
Yes. The export limit is a property of the Search Console interface, not the API. A scheduled job pages through the full result set and writes all of it.
Why does my property URL not work?
A DNS-verified property is a Domain property, and the API addresses it as sc-domain:example.com rather than https://example.com/. Passing the URL form returns 403 even with correct permissions.
Can I run my own SQL rather than reading a table?
Yes. Set a query instead of a table and aggregate in the database, which is usually far cheaper than moving raw rows and aggregating downstream. One statement only - multi-statement queries are rejected.
Does it need a superuser?
No. A user with SELECT on what you are reading is enough for a source; a destination needs INSERT and, for upsert, UPDATE on the target table.
Is the Google Search Console connector free to use?
You can connect Google Search Console and start syncing on the free plan.
Other sources into PostgreSQL
Related reading
Export Search Console data past 1,000 rows
The Search Console UI exports 1,000 rows and keeps 16 months. The API has neither limit on export. Here is how to get every query into Google Sheets or Postgres on a schedule.
Airtable upsert: stop creating duplicate records
Appending on every run turns a tidy base into six copies of every row. Here is how upsert works in Airtable, and how to choose a merge key that holds up.
Get data into Google Sheets without an add-on
Every major Sheets data tool is an add-on you install, authorise and keep updated inside the spreadsheet. Here is how to schedule the same imports without one.