How to get Google Trends data in Python

Checked on 2026-11-19.

Google Trends has no open API yet: Google's own Trends API is an alpha that you apply for. Until you are let in, there are four other routes: the pytrends library (archived, and rate-limited by Google), the Download button on the Trends page, Google's BigQuery dataset of top terms, and an HTTP API that reads Trends for you. Here is each one, with code where there is code to write, and where it stops.

1. pytrends

A free library that takes no API key and returns pandas DataFrames.

Python
# pip install pytrends
from pytrends.request import TrendReq

pytrends = TrendReq(hl="en-US", tz=360)
pytrends.build_payload(["pickleball"], cat=0, timeframe="today 12-m", geo="US", gprop="")

over_time = pytrends.interest_over_time()        # a pandas DataFrame
by_region = pytrends.interest_by_region(resolution="REGION", inc_low_vol=True, inc_geo_code=False)
related = pytrends.related_queries()             # a dictionary of DataFrames
print(over_time.tail())

timeframe takes values such as today 12-m, today 5-y (the default) and all. geo is a two-letter country code, or empty for the world. The list of keywords holds up to five terms to compare.

Where it breaks: the repository was archived by its owner on April 17, 2025 and is read-only; the latest release, 4.9.2, is from April 2023. The README calls the library an "Unofficial API for Google Trends" that is "Only good until Google changes their backend again". The error its issue tracker reports again and again is HTTP 429, raised as TooManyRequestsError, and the README says: "Rate Limit is not publicly known". The guide to the pytrends 429 error covers what can and cannot be done about it.

2. Google's Trends API (alpha)

Google announced an official Google Trends API on July 24, 2025. On the day this guide was checked it was still an alpha: its page says "We're now accepting applications for alpha testers" and "we can't open the API for everyone yet". You apply with the form on developers.google.com/search/apis/trends. Google says it gives priority to developers who know what they want to do, can start soon and are willing to give feedback.

What it offers, according to the announcement: a rolling window of 1800 days (about 5 years) that ends 2 days ago; daily, weekly, monthly and yearly aggregation; regions and sub-regions. Its values are "consistently scaled" across requests instead of being scaled from 0 to 100 on every request, so data from separate requests can be joined.

Where it stops: you cannot sign up and call it. There is an application form, and we found no public reference to write code against, which is why there is no sample here.

3. The Download button

For a one-off, the Trends page is the simplest route. Google's help page gives the steps: open Google Trends, search for a term, and "In the top right of the chart, click Download". You get a CSV file for that chart, which opens in a spreadsheet application. Look at its first lines before you parse it in Python.

Where it stops: it is manual, one chart at a time. The same page says: "If you reuse Trends data, attribute the information to Google with a citation."

4. The BigQuery dataset

Google also publishes Trends data as public BigQuery datasets: the top 25 and the top 25 rising queries, for 210 market areas of the United States and for about 50 other countries. BigQuery's free tier covers up to 1 TB of queries a month, and its sandbox works without a credit card.

Python
# pip install --upgrade google-cloud-bigquery
from google.cloud import bigquery

client = bigquery.Client()
query = """
SELECT * FROM `bigquery-public-data.google_trends.top_terms`
WHERE refresh_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
LIMIT 25
"""
for row in client.query_and_wait(query):
    print(row)

Where it stops: it holds what is trending, not what you ask about. You cannot give it a term and get that term's interest over time. The Python client also needs Google credentials set up on your machine.

5. An HTTP API

Pipefetch reads Google Trends for one term and returns everything in one JSON answer: the timeline, the regions, the top and rising related queries, and a summary.

Python
import os
import requests

res = requests.get(
    "https://pipefetch.com/v1/google/trends",
    params={"q": "pickleball", "geo": "US", "period": "12m"},
    headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
    timeout=90,
)
if res.status_code == 404:
    print("Too little search volume for this term")   # not charged
elif res.status_code == 502:
    print("Google Trends turned the request away")    # not charged, send it again
else:
    res.raise_for_status()
    data = res.json()["data"]
    print(data["summary"]["averageInterest"], data["summary"]["trendDirection"])
    for point in data["interestOverTime"]:
        print(point["date"], point["interest"])
    for region in data["interestByRegion"][:5]:
        print(region["regionName"], region["interest"])
    for query in data["relatedQueries"]["rising"][:5]:
        print(query["query"], query["formattedValue"])

geo is a two-letter country code; leave it out for the whole world. period is one of nine, from the past hour (1h) to everything since 2004 (all); the default is 12 months. The values are Google Trends' own index from 0 to 100. The last point of a timeline is usually incomplete and marked isPartial. The reference lists every field.

Where it stops: one request measures one term, so there are no comparisons of several terms. Related topics are not included. A single state or city cannot be asked for on its own. Google Trends limits how many searches one address may make, ours included: when it turns ours away, the request answers 502 upstream_error, costs nothing and can be sent again. And it is not an official API: Pipefetch is not affiliated with Google.

A request costs 1 credit, a term with too little data (404) costs nothing, and a new account has 100 free credits and needs no card.

Which one should you use?

SituationUse
A notebook on your own computer, a few termspytrends, with patience for 429 errors
One chart, onceThe Download button
What is trending by day and areaThe BigQuery dataset
A long-term product on official dataApply for Google's Trends API alpha
A server, a scheduled job or an AI agent that needs a term's data nowAn HTTP API such as Pipefetch

What the numbers mean, whichever route you take

Trends values are not search counts. Google's FAQ says: "Each data point is divided by the total searches of the geography and time range it represents", and the results are "scaled on a range of 0 to 100". The data is a sample of searches, and a term with low volume appears as 0.

Two things follow. The Trends website scales the results from 0 to 100 on every request, and so does every route that reads the website: the 100 of one period is not the 100 of another, and two downloads cannot be glued together as they are. And a region's 100 means the largest share of that region's own searches, not the most searches, which can put a small region first. See why Wyoming is first in Google Trends.

Try it with 100 free credits. No card needed. No scraper to build or maintain. Get an API key or read the docs.

Every source

YouTube

Instagram

Websites

TikTok

Facebook

Threads

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides