Skip to content

bigfunctions > get_google_trends

get_google_trends

Call or Deploy get_google_trends ?

✅ You can call this get_google_trends bigfunction directly from your Google Cloud Project (no install required).

  • This get_google_trends function is deployed in bigfunctions GCP project in 39 datasets for all of the 39 BigQuery regions. You need to use the dataset in the same region as your datasets (otherwise you may have a function not found error).
  • Function is public, so it can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
  • You may prefer to deploy the BigFunction in your own project if you want to build and manage your own catalog of functions. This is particularly useful if you want to create private functions (for example calling your internal APIs). Discover the framework

Public BigFunctions Datasets:

Region Dataset
eu bigfunctions.eu
us bigfunctions.us
europe-west1 bigfunctions.europe_west1
asia-east1 bigfunctions.asia_east1
... ...

Description

Signature

get_google_trends(keywords, timeframe, geo, category, gprop)

Description

GET Google Trends data

Params

Param Description
destination_table Fully qualified destination table (PROJECT.DATASET.TABLE)
keywords Array of one to five search terms (a search term can be an expression)
start_month First month (YYYY-MM) to load data from
geo Two letter country abbreviation. For example United States is 'US'. Defaults to World. More detail available for States/Provinces by specifying additional abbreviations. For example: Alabama would be 'US-AL'. For example: England would be 'GB-ENG'
category Category to narrow results. Find available categories by inspecting the url when manually using Google Trends. The category starts after cat= and ends before the next & or view this wiki page containing all available categories. For example: "https://www.google.com/trends/explore#q=pizza&cat=71". '71' is the category. Defaults to no category
gprop What Google property to filter to. Example 'images'. Defaults to web searches. Can be images, news, youtube or froogle (for Google Shopping results)

This function may return []

Google Trends put some quotas to request their API. For this reason, this function may sometimes return []. It is advised to call it several times a day if you want to make sure to retrieve the data.

Examples

GET trends for chaise and fauteuil

select bigfunctions.eu.get_google_trends('chaise, fauteuil', 11, '2025-01-01 2025-01-07', 'FR', null)
select bigfunctions.us.get_google_trends('chaise, fauteuil', 11, '2025-01-01 2025-01-07', 'FR', null)
select bigfunctions.europe_west1.get_google_trends('chaise, fauteuil', 11, '2025-01-01 2025-01-07', 'FR', null)
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| trends                                                                                                                                                                                                                                                                                       |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| [
  {"date":"2019-12-01T00:00:00", "keyword": "chaise", "value": 58},
  {"date":"2019-12-01T00:00:00", "keyword": "fauteuil", "value": 2},
  {"date":"2019-12-08T00:00:00", "keyword": "chaise", "value": 57},
  {"date":"2019-12-08T00:00:00", "keyword": "fauteuil", "value": 3},
  ...
]
 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Need help using get_google_trends?

The community can help! Engage the conversation on Slack

For professional suppport, don't hesitate to chat with us.

Found a bug using get_google_trends?

If the function does not work as expected, please

  • report a bug so that it can be improved.
  • or open the discussion with the community on Slack.

For professional suppport, don't hesitate to chat with us.

Spread the word

BigFunctions is fully open-source. Help make it a success by spreading the word!

Share on Add a on