# Google Trends Scraper (`apify/google-trends-scraper`) Actor

Scrape data from Google Trends by search terms or URLs. Specify locations, define time ranges, select categories to get interest by subregion and over time, related queries and topics, and more. Export scraped data, run the scraper via API, schedule and monitor runs, or integrate with other tools.

- **URL**: https://apify.com/apify/google-trends-scraper.md
- **Developed by:** [Apify](https://apify.com/apify) (Apify)
- **Categories:** SEO tools, News
- **Security:** Limited permissions
- **Stats:** 18,734 total users, 3,268 monthly users, 98.1% runs succeeded, 249 bookmarks
- **User rating**: 3.68 out of 5 stars

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### 🌍 What is Google Trends Scraper?

Google Trends Scraper crawls specified search queries and Google Trends URLs, and extracts data from Google Trends pages in structured formats such as JSON, CSV, XML, or Excel. With this Google Trends API, you will be able to extract the following Google Trends data:

<table>
<tr>
<td>🔍 Search term</td>
<td>🏙 Interest by city</td>
</tr>
<tr>
<td>🌍 Interest by subregion</td>
<td>🗺 Geo code and Geo name</td>
</tr>
<tr>
<td>📊 Average interest over time</td>
<td>📆 Timeline of the interest over time</td>
</tr>
<tr>
<td>🔺 Rising related queries</td>
<td>🔝 Top related queries</td>
</tr>
<tr>
<td>⬆️ Rising related topics</td>
<td>⭐️ Top related topics</td>
</tr>
</table>

### 🌐 How do I use Google Trends Scraper?

Google Trends Scraper is designed to be user-friendly, even for those who have never extracted data from the web before. Here’s how you can use Google Trends Scraper to extract data from Google Trends:

1. [Create](https://console.apify.com/sign-up) an Apify account
2. Open [Google Trends Scraper](https://apify.com/apify/google-trends-scraper).
3. Enter your search term, location, and time range. Or use a Google Trends URL with applied filters instead.
4. Click the “Start” button and wait for the data to be extracted.
5. Download your data in JSON, CSV, Excel, XML, or HTML.

If you need guidance on how to run the scraper, you can read the [step-by-step guide to scraping Google Trends](https://blog.apify.com/step-by-step-guide-to-scraping-google-trends/); it includes use cases, screenshots, and examples. Or [watch a short video tutorial](https://www.youtube.com/watch?v=qtgkqKAIxjk) ▷ on YouTube.

[Google Trends scraping tool](https://www.youtube.com/watch?v=qtgkqKAIxjk)

### 📉 What can you do with scraped Google Trends data?

🔍 **Back up your market research** by tracking the popularity of search terms and identifying trending topics

📊 **Find business insights** by comparing the popularity of multiple search terms and seeing how they relate to each other

📍 **Generate content ideas** by exploring regional interest and seeing which areas are searching for specific topics the most

💡 **Discover related queries and topics** to gain a deeper understanding of user interests

🕒 **Improve your SEO game** by analyzing search trends over time to identify seasonal patterns or long-term changes in user behavior

### ⬇️ Input example

You can scrape Google Trends either **by search query** or **by a Google Trends URL**. For a full explanation of input including an example in JSON, head over to the [input tab](https://apify.com/apify/google-trends-scraper/input-schema).

You can set up the input programmatically or use the fields in the scraper’s interface:

<img width="80%" src="https://github.com/apify-projects/actor-readme-images/blob/master/Google%20Trends%20scraping%20data.png?raw=true" />

### ⬆️ Output example

The scraped Google Trends data will be shown as a dataset which you can find in the **Output** tab. Note that the output is organized as a table for viewing convenience:

<img width="80%" src="https://github.com/apify-projects/actor-readme-images/blob/master/Google%20trends%20API.png?raw=true" />

You can preview all the fields and choose in which format to download Google Trends data you’ve extracted: JSON, Excel, HTML table, CSV, or XML. Here below is the same dataset in JSON:

```json
{
  "inputUrlOrTerm": "web scraping",
  "searchTerm": "web scraping",
  "interestOverTime_timelineData": [
    {
      "time": "1673136000",
      "formattedTime": "Jan 8 – 14, 2023",
      "formattedAxisTime": "Jan 8, 2023",
      "value": [
        99
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "99"
      ]
    },
    {
      "time": "1673740800",
      "formattedTime": "Jan 15 – 21, 2023",
      "formattedAxisTime": "Jan 15, 2023",
      "value": [
        96
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "96"
      ]
    },
    {
      "time": "1674345600",
      "formattedTime": "Jan 22 – 28, 2023",
      "formattedAxisTime": "Jan 22, 2023",
      "value": [
        99
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "99"
      ]
    },
    {
      "time": "1674950400",
      "formattedTime": "Jan 29 – Feb 4, 2023",
      "formattedAxisTime": "Jan 29, 2023",
      "value": [
        98
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "98"
      ]
    },
    {
      "time": "1675555200",
      "formattedTime": "Feb 5 – 11, 2023",
      "formattedAxisTime": "Feb 5, 2023",
      "value": [
        100
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "100"
      ]
    },
    {
      "time": "1676160000",
      "formattedTime": "Feb 12 – 18, 2023",
      "formattedAxisTime": "Feb 12, 2023",
      "value": [
        91
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "91"
      ]
    },
    {
      "time": "1676764800",
      "formattedTime": "Feb 19 – 25, 2023",
      "formattedAxisTime": "Feb 19, 2023",
      "value": [
        98
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "98"
      ]
    },
{
      "time": "1703376000",
      "formattedTime": "Dec 24 – 30, 2023",
      "formattedAxisTime": "Dec 24, 2023",
      "value": [
        80
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "80"
      ]
    },
    {
      "time": "1703980800",
      "formattedTime": "Dec 31, 2023 – Jan 6, 2024",
      "formattedAxisTime": "Dec 31, 2023",
      "value": [
        81
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "81"
      ]
    },
    {
      "time": "1704585600",
      "formattedTime": "Jan 7 – 13, 2024",
      "formattedAxisTime": "Jan 7, 2024",
      "value": [
        91
      ],
      "hasData": [
        true
      ],
      "formattedValue": [
        "91"
      ],
      "isPartial": true
    }
  ],
  "interestOverTime_averages": [],
  "interestBySubregion": [],
  "interestByCity": [],
  "relatedTopics_top": [
    {
      "topic": {
        "mid": "/m/07ykbs",
        "title": "Web scraping",
        "type": "Topic"
      },
      "value": 100,
      "formattedValue": "100",
      "hasData": true,
      "link": "/trends/explore?q=/m/07ykbs&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/0828v",
        "title": "World Wide Web",
        "type": "Topic"
      },
      "value": 97,
      "formattedValue": "97",
      "hasData": true,
      "link": "/trends/explore?q=/m/0828v&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/05z1_",
        "title": "Python",
        "type": "Programming language"
      },
      "value": 29,
      "formattedValue": "29",
      "hasData": true,
      "link": "/trends/explore?q=/m/05z1_&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/026sq",
        "title": "Data",
        "type": "Topic"
      },
      "value": 14,
      "formattedValue": "14",
      "hasData": true,
      "link": "/trends/explore?q=/m/026sq&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/085n4",
        "title": "Website",
        "type": "Topic"
      },
      "value": 9,
      "formattedValue": "9",
      "hasData": true,
      "link": "/trends/explore?q=/m/085n4&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/0c828v",
        "title": "Selenium",
        "type": "Software"
      },
      "value": 5,
      "formattedValue": "5",
      "hasData": true,
      "link": "/trends/explore?q=/m/0c828v&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/0z5n",
        "title": "Application programming interface",
        "type": "Type of software"
      },
      "value": 5,
      "formattedValue": "5",
      "hasData": true,
      "link": "/trends/explore?q=/m/0z5n&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/022qrc8",
        "title": "Beautiful Soup",
        "type": "HTML parser"
      },
      "value": 5,
      "formattedValue": "5",
      "hasData": true,
      "link": "/trends/explore?q=/m/022qrc8&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/07k1x",
        "title": "Tool",
        "type": "Topic"
      },
      "value": 5,
      "formattedValue": "5",
      "hasData": true,
      "link": "/trends/explore?q=/m/07k1x&date=today+12-m"
    },
    {
      "topic": {
        "mid": "/m/086nh",
        "title": "Web page",
        "type": "Topic"
      },
      "value": 5,
      "formattedValue": "5",
      "hasData": true,
      "link": "/trends/explore?q=/m/086nh&date=today+12-m"
    },
{
      "topic": {
        "mid": "/m/0g57xn",
        "title": "Sentiment analysis",
        "type": "Field of study"
      },
      "value": 50,
      "formattedValue": "+50%",
      "link": "/trends/explore?q=/m/0g57xn&date=today+12-m"
    }
  ],
  "relatedQueries_top": [
    {
      "query": "python scraping",
      "value": 100,
      "formattedValue": "100",
      "hasData": true,
      "link": "/trends/explore?q=python+scraping&date=today+12-m"
    },
    {
      "query": "python",
      "value": 96,
      "formattedValue": "96",
      "hasData": true,
      "link": "/trends/explore?q=python&date=today+12-m"
    },
    {
      "query": "web scraping python",
      "value": 94,
      "formattedValue": "94",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+python&date=today+12-m"
    },
    {
      "query": "web data scraping",
      "value": 39,
      "formattedValue": "39",
      "hasData": true,
      "link": "/trends/explore?q=web+data+scraping&date=today+12-m"
    },
    {
      "query": "data scraping",
      "value": 38,
      "formattedValue": "38",
      "hasData": true,
      "link": "/trends/explore?q=data+scraping&date=today+12-m"
    },
    {
      "query": "web scraping in python",
      "value": 18,
      "formattedValue": "18",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+in+python&date=today+12-m"
    },
    {
      "query": "what is web scraping",
      "value": 17,
      "formattedValue": "17",
      "hasData": true,
      "link": "/trends/explore?q=what+is+web+scraping&date=today+12-m"
    },
    {
      "query": "selenium web scraping",
      "value": 17,
      "formattedValue": "17",
      "hasData": true,
      "link": "/trends/explore?q=selenium+web+scraping&date=today+12-m"
    },
    {
      "query": "selenium",
      "value": 16,
      "formattedValue": "16",
      "hasData": true,
      "link": "/trends/explore?q=selenium&date=today+12-m"
    },
    {
      "query": "web scraping google",
      "value": 16,
      "formattedValue": "16",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+google&date=today+12-m"
    },
    {
      "query": "api",
      "value": 16,
      "formattedValue": "16",
      "hasData": true,
      "link": "/trends/explore?q=api&date=today+12-m"
    },
    {
      "query": "website scraping",
      "value": 16,
      "formattedValue": "16",
      "hasData": true,
      "link": "/trends/explore?q=website+scraping&date=today+12-m"
    },
    {
      "query": "web scraping api",
      "value": 16,
      "formattedValue": "16",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+api&date=today+12-m"
    },
    {
      "query": "web scraping using python",
      "value": 15,
      "formattedValue": "15",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+using+python&date=today+12-m"
    },
    {
      "query": "web scraping with python",
      "value": 14,
      "formattedValue": "14",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+with+python&date=today+12-m"
    },
    {
      "query": "web scraping tools",
      "value": 12,
      "formattedValue": "12",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+tools&date=today+12-m"
    },
    {
      "query": "beautifulsoup",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=beautifulsoup&date=today+12-m"
    },
    {
      "query": "beautifulsoup web scraping",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=beautifulsoup+web+scraping&date=today+12-m"
    },
    {
      "query": "web scraping free",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=web+scraping+free&date=today+12-m"
    },
    {
      "query": "web scraper",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=web+scraper&date=today+12-m"
    },
    {
      "query": "scraper",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=scraper&date=today+12-m"
    },
    {
      "query": "scrape",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=scrape&date=today+12-m"
    },
    {
      "query": "web scrape",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=web+scrape&date=today+12-m"
    },
    {
      "query": "python selenium web scraping",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=python+selenium+web+scraping&date=today+12-m"
    },
    {
      "query": "python selenium",
      "value": 11,
      "formattedValue": "11",
      "hasData": true,
      "link": "/trends/explore?q=python+selenium&date=today+12-m"
    }
  ],
  "relatedQueries_rising": [
    {
      "query": "chatgpt web scraping",
      "value": 4250,
      "formattedValue": "+4,250%",
      "link": "/trends/explore?q=chatgpt+web+scraping&date=today+12-m"
    },
    {
      "query": "analisis data adalah",
      "value": 1150,
      "formattedValue": "+1,150%",
      "link": "/trends/explore?q=analisis+data+adalah&date=today+12-m"
    },
    {
      "query": "analisis data",
      "value": 750,
      "formattedValue": "+750%",
      "link": "/trends/explore?q=analisis+data&date=today+12-m"
    },
{
      "query": "playwright",
      "value": 50,
      "formattedValue": "+50%",
      "link": "/trends/explore?q=playwright&date=today+12-m"
    },
    {
      "query": "web scraping tool free",
      "value": 50,
      "formattedValue": "+50%",
      "link": "/trends/explore?q=web+scraping+tool+free&date=today+12-m"
    }
  ],
  "interestBy": [
    {
      "geoCode": "SH",
      "geoName": "St. Helena",
      "value": [
        100
      ],
      "formattedValue": [
        "100"
      ],
      "maxValueIndex": 0,
      "hasData": [
        true
      ]
    },
    {
      "geoCode": "TN",
      "geoName": "Tunisia",
      "value": [
        60
      ],
      "formattedValue": [
        "60"
      ],
      "maxValueIndex": 0,
      "hasData": [
        true
      ]
    },
    {
      "geoCode": "SG",
      "geoName": "Singapore",
      "value": [
        56
      ],
      "formattedValue": [
        "56"
      ],
      "maxValueIndex": 0,
      "hasData": [
        true
      ]
    },
    {
      "geoCode": "PK",
      "geoName": "Pakistan",
      "value": [
        46
      ],
      "formattedValue": [
        "46"
      ],
      "maxValueIndex": 0,
      "hasData": [
        true
      ]
    },
{
      "geoCode": "KM",
      "geoName": "Comoros",
      "value": [
        0
      ],
      "formattedValue": [
        ""
      ],
      "maxValueIndex": 0,
      "hasData": [
        false
      ]
    },
    {
      "geoCode": "IO",
      "geoName": "British Indian Ocean Territory",
      "value": [
        0
      ],
      "formattedValue": [
        ""
      ],
      "maxValueIndex": 0,
      "hasData": [
        false
      ]
    }
  ]
}]
```

### 📍 Want to try other Google scrapers?

Use the dedicated scrapers below if you want to scrape specific public data from Google services. Each of them is built particularly for the relevant scraping case, be it Google Places, images, Google trending searches, or Google Search Engine Results Page (SERP) data. Feel free to browse them:

<table>
<tr>
<td>🔍 <a href="https://apify.com/apify/google-search-scraper">Google Search Results Scraper</a></td>
<td>👁 <a href="https://apify.com/alexey/google-lens">Google Lens Scraper</a></td>
</tr>
<tr>
<td>📍 <a href="https://apify.com/compass/crawler-google-places">Google Maps Scraper</a></td>
<td>📩 <a href="https://apify.com/lukaskrivka/google-maps-with-contact-details">Google Maps Email Extractor</a></td>
</tr>
<tr>
<td>📉 <a href="https://apify.com/hooli/google-trending-searches">Google Trending Searches</a></td>
<td>📰 <a href="https://apify.com/lhotanok/google-news-scraper">Google News Scraper</a></td>
</tr>
<tr>
<td>⭐️<a href="https://apify.com/compass/google-maps-reviews-scraper">Google Maps Reviews Scraper</a></td>
<td>🤖 <a href="https://apify.com/geneea/reviews-text-nlp-analyzer">AI Text Analyzer for Google Reviews</a></td>
</tr>
<tr>
<td>💼 <a href="https://apify.com/dan.scraper/google-jobs-scraper">Google Jobs Scraper</a></td>
<td>🎮 <a href="https://apify.com/epctex/google-play-scraper">Google Play Scraper</a></td>
</tr>
</table>

### ❓FAQ

#### Is there a Google Trends API?

Google Trends does not offer an official API for public use. This means there isn't a dedicated Application Programming Interface provided by Google specifically for Google Trends data. But you can use scrapers and crawlers as a stand-in for a web scraping API, e.g. **📈📉[Google Trends Scraper](https://apify.com/apify/google-trends-scraper)**.

#### Can I use Google Trends Scraper data with the API?

Yes, you can do so by using the Apify API. It gives you programmatic access to the Apify platform. The API is organized around RESTful HTTP endpoints that enable you to manage, schedule, and run Apify Actors such as this one. The API also lets you access any datasets, monitor Actor performance, fetch results, create and update versions, and more.

To access the API using Node.js, use the `apify-client` [npm package](https://apify.com/apify/google-trends-scraper/api/client/nodejs). To access the API using Python, use the `apify-client` [PyPI package](https://apify.com/apify/google-trends-scraper/api/client/python).

Check out the <a href="https://docs.apify.com/api/v2"  target="_blank"> Apify API reference</a> docs for full details or click on the <a href="https://apify.com/apify/google-trends-scraper/api"  target="_blank"> API tab</a> for code examples and API endpoints.

#### Can I create a Google Trends integration using data from this scraper?

Yes. Google Trends Scraper can be connected with almost any cloud service or web app thanks to <a href="https://apify.com/integrations"  target="_blank">integrations on the Apify platform</a>. You can integrate with Make, Zapier, Slack, Airbyte, GitHub, Google Sheets, Google Drive, LangChain, <a href="https://docs.apify.com/integrations"  target="_blank">and more</a>.

Or you can use <a href="https://docs.apify.com/integrations/webhooks"  target="_blank">webhooks</a> to carry out an action whenever an event occurs, e.g. get a notification whenever Google Trends Scraper successfully finishes a run.

#### Can I use this Google Trends API in Python?

Yes, by using the Apify API. To access the [Google Trends API using Python](https://apify.com/apify/google-trends-scraper/api/client/python), use the `apify-client` PyPI package. You can find more details about the client [in the Apify Docs](https://docs.apify.com/api/client/python/).

#### Is it legal to scrape Google Trends data?

It is legal to scrape publicly available data from Google Trends. However, you should always review and comply with Google's terms of service and any applicable laws and regulations regarding web scraping. Additionally, be mindful of any rate limits or restrictions imposed by Google to avoid potential issues.

#### Not your cup of tea? Build your own scraper.

Google Trends Scraper doesn’t exactly do what you need? You can always build one of your own! We have various [scraper templates](https://apify.com/templates) in Python, JavaScript, and TypeScript to get you started. Alternatively, you can write it from scratch using the [open-source library Crawlee](https://crawlee.dev/). You can keep the scraper to yourself or make it public by adding it to Apify Store (and [find users](https://apify.com/partners/actor-developers) for it).

#### Your feedback

We’re always working on improving the performance of Apify’s Actors. So if you’ve got any technical feedback for Google Trends Scraper or simply found a bug, please create an issue on the Actor’s [Issues tab](https://console.apify.com/actors/DyNQEYDj9awfGQf9A/console) in Apify Console.

# Changelog

This Actor's version history is a separate document: https://apify.com/apify/google-trends-scraper/changelog.md

# Actor input Schema

## `searchTerms` (type: `array`):

(Required if 'spreadsheetId' is not provided) List of search terms to be scraped.

## `isMultiple` (type: `boolean`):

If checked, a comma is treated as a separator for multiple terms

## `timeRange` (type: `string`):

Choose a predefined search's time range (defaults to 'Past 12 months')

## `geo` (type: `string`):

Get results from a specific geo area (defaults to 'Worldwide'). This maps to different fields in the dataset results: smaller countries like Greece return just 'interestByCity' data, while larger ones like the United States return 'interestBySubregion' data as well. When omitted (Worldwide), 'interestBy' is returned instead, which corresponds to the 'Interest by area' section on Google Trends. Note: When using Google Trends URLs from the '🔗 Use a Google Trends URL instead of search terms' section, the geo parameter from the URL's query string takes precedence over this setting. You can also use start URLs to retrieve 'interestByMetro' data for metropolitan areas by providing URLs with more specific geo regions like California (US) directly copied from Google Trends.

## `viewedFrom` (type: `string`):

Country for residential proxies to ensure correct results

## `startUrls` (type: `array`):

Copy a Google Trends URL and paste it here.

## `spreadsheetId` (type: `string`):

(Optional) ID of the Google Sheet from where search terms will be loaded.
Spreadsheet must have only one column. Row 1 is considered the title of the column so it will not be loaded as a search term. The provided spreadsheet must be publicly available. Check the actor documentation for more info.

## `category` (type: `string`):

Choose a category to filter the search for (defaults to 'All categories')

## `maxItems` (type: `integer`):

Maximum number of items to scrape. Zero means no limit.

## `customTimeRange` (type: `string`):

Provide custom time range. If present, it takes precedence over regular timeRange. Format is: `YYYY-MM-DD YYYY-MM-DD`. See examples in the documentation.

## `maxConcurrency` (type: `integer`):

How many pages will be opened in parallel if enough CPU is available.

## `maxRequestRetries` (type: `integer`):

How many times will the Actor retry a request if it fails.

## Actor input object example

```json
{
  "searchTerms": [
    "webscraping"
  ],
  "isMultiple": false,
  "timeRange": "today 3-m",
  "geo": "",
  "viewedFrom": "",
  "startUrls": [
    {
      "url": "https://trends.google.com/trends/explore?q=web+scraping&geo=US"
    }
  ],
  "spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
  "category": "",
  "maxItems": 0,
  "customTimeRange": "2024-01-01 2024-12-31",
  "maxConcurrency": 10,
  "maxRequestRetries": 7
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all scraped results

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "webscraping"
    ],
    "timeRange": "",
    "viewedFrom": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("apify/google-trends-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["webscraping"],
    "timeRange": "",
    "viewedFrom": "",
}

# Run the Actor and wait for it to finish
run = client.actor("apify/google-trends-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "webscraping"
  ],
  "timeRange": "",
  "viewedFrom": ""
}' |
apify call apify/google-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apify/google-trends-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DyNQEYDj9awfGQf9A/builds/6OtslOpWz85lSuRLM/openapi.json
