Bulk export Google Trends rising keywords using Python

My latest script is all about using Python to scrape Google Trends rising keywords to generate article ideas. No coding is required and it is built on Google Colab so no extra software is required, making it a simple solution for all SEOs.

The problem

Its important to ensure that your website's content is targeting the subjects which readers are most likely to be interested in right now. Fortunately, Google Trends is available to help. When searching for a topic, Google is kind enough to provide you with a list of rising keywords, as follows: [gallery size="medium" link="none" ids="206"] This is great if you only want ideas based on a single keyword, but what if you want to do this for 10 keywords? 20? 100? Doing this manually just isn't practical. Therefore, a more automated approach is required. Therefore, I have created a script to help. Visit here to try the script via Google Colab.


All that is needed is a CSV with keywords and category IDs, using the template below:

Create CSV in this format[/caption]

(EDIT: please ensure that your CSV uses commas as delimiters or the script will not work) To get the category ID for your keywords, check the parameter in Google Trends when making a search as shown below. This can be a bit of a manual process the first time you do it, but make it easier for future scrapes.

Use category parameter to identify category ID[/caption]

Using the script

I have built this script using Google Colab to make it easy for anyone to use it, regardless of experience. Visit here to try the script via Google Colab. The first step is to install pyTrends by activating the first code box, shown below: 

By default, the script is set to scrape search trends in UK over the last 7 days. To change this, update the following line: pytrend.build_payload(kw_list,cat,timeframe='now 7-d',geo='GB') For example, to show the trends over the last month, update to 'now 1-m' or change to 'now 14-d' for the last 14 days. To change the country to USA, update the geo parameter from GB to US. Once configured to your liking, you are ready to go, activate the code block and upload your CSV. The script will cycle through each keyword then export 2 new CSVs; one for top terms and one for rising terms. And that's it! You have all the data you need to find content ideas based on what is trending right now. Importing your list into your favourite keyword research tool will make this even more powerful.

A note about Pandas

The more experienced coders reading this will notice that I import CSVs into dataframes, convert them into lists then convert the output list back to into dataframes before downloading. I am aware that this might be a long-winded way of completing this task, but I haven't yet mastered the art of Pandas. I may revisit this script once I've developed my Python skills more, but the script works pretty well so its not needed at present. Whilst you're here, why not check out our simple guide to automate product keyword research.