Google Trends has no official public API, and the website hands you one chart at a time. If you want trend data in a spreadsheet, a dashboard or an AI agent's context (tracking demand for a product category every week, or spotting rising queries before they peak), you need another way to get it.
This tutorial uses Google Trends Scraper, an Apify actor I built. It returns three Google Trends widgets for up to 20 keywords per run: interest over time, interest by region and related queries. The output is flat rows that drop straight into Sheets or a BI tool. It works for any country or worldwide, over 7 days to 5 years, with no browser and no API key. The full examples are on GitHub: auto-actor/google-trends-scraper-all-widgets.
What people use it for
- Weekly demand tracking for your product category or brand in one spreadsheet.
- Finding rising related queries before they peak, for content and ads.
- Comparing interest across countries for market entry decisions.
Input
{"keywords": ["bitcoin"], "geo": "", "timeRange": "past_12_months"}
| Field | What it does |
|---|---|
keywords |
Up to 20 search terms to analyse. |
geo |
Two-letter country code such as US, AU or GB, or empty for worldwide. |
timeRange |
One of past_7_days, past_30_days, past_90_days, past_12_months, past_5_years. |
Python
"""Run Google Trends Scraper on Apify and print the results.
pip install apify-client
export APIFY_TOKEN=... # Apify Console -> Settings -> Integrations
python example.py
"""
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("daedal_quintuplet/google-trends-scraper-all-widgets").call(
run_input={
"keywords": [
"bitcoin"
],
"geo": "",
"timeRange": "past_12_months"
}
)
rows = client.dataset(run["defaultDatasetId"]).iterate_items()
for row in rows:
print(row["kind"], "|", row["label"], "|", row["value"])
Node.js
// Run Google Trends Scraper on Apify and print the results.
//
// npm install apify-client
// APIFY_TOKEN=... node example.js (token: Apify Console -> Settings -> Integrations)
const { ApifyClient } = require('apify-client');
async function main() {
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('daedal_quintuplet/google-trends-scraper-all-widgets').call({
"keywords": [
"bitcoin"
],
"geo": "",
"timeRange": "past_12_months"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const row of items) {
console.log(row.kind, '|', row.label, '|', row.value);
}
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
No code: one HTTP request
Works from n8n, Make, Zapier or curl:
curl -X POST "https://api.apify.com/v2/acts/daedal_quintuplet~google-trends-scraper-all-widgets/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"keywords": ["bitcoin"], "geo": "", "timeRange": "past_12_months"}'
What you get
Every row has a kind, so you can filter it into one table per widget:
| Field | Meaning |
|---|---|
keyword |
The search term the row belongs to |
kind |
interest_over_time, interest_by_region or related_query
|
label |
Week range, region name or related query text, depending on kind
|
time |
Unix seconds for interest_over_time rows; null otherwise |
value |
Google's relative score, 0 to 100 |
geo |
Country code or worldwide
|
trend |
related_query rows only: whether the query is from the top or rising list |
link |
related_query rows only: link to that query on Google Trends |
Google Trends values are relative: 100 is the highest point for that keyword in the period you picked, not a count of searches.
Price
$0.0025 per row ($2.50 per 1,000 rows), paid per result, with no monthly fee. One keyword over 12 months produced about 170 rows in our tests, so about $0.43. Apify's free plan includes $5 of usage a month, which is enough to try it.
Links: Store page ยท GitHub examples
Top comments (0)