Building an automated solution to download Google Trends data for a large number of terms.

What you will learn

Set up your own process in R to autonomously download and process large amounts of Google Trends data.

Automate various tasks used in a day to day life of a data scientist through R.

Understand each line of code used in the course and how it fits in the bigger picture of a live project.

Two independent approaches used in the course to access Trends data will reinforce the concept of building R solutions from scratch. In one approach, we will exclusively use Base R methods, and in other, learn how to work with R packages.

You will be able to run various windows commands from R e.g. copy, rename, delete files on hard disc etc

Use Window’s Task Scheduler to have desktop run R in batch mode on recurring basis.

Your R toolbox will become much more diverse and applicable to a wide range of future projects.


Google Trends is a new tool in a Data Scientist or a Marketing Analyst’s tool box. It provides data that could be quite useful when assessing trend in general public interest in a particular product or an array of products. Trends data essentially gives us a way to assess how often a particular search was performed on world’s most popular search engine.

However, Google Trends only allows a simultaneous search of up to five terms, also it does not provide data through a dedicated API. This course describes two processes in R which could be employed to circumvent both of these issues. First process stitches together R and Windows batch system. Second, utilize gtrendsR package. In both case we set up an automated process.

Get Instant Notification of New Courses on our Telegram channel.

The course begins by describing Google Trends data itself, and then various R functions relevant to build the automated solution. In the third section, we apply the knowledge from previous sections to build a complete end to end solution.

By the end of the course, we will better understand how R could be employed in more automated manner with minimum human involvement. Additionally, better appreciate the power of Google Trends data to provide a greater understanding of the way the world around us functions.



Introduction to Google Trends web Search engine


Understanding R functions one at a time

Import Export of txt and csv files
Data Frames in R Part 1
Data Frames in R Part 2
Performing system functions using R
Understand lapply and docall functions in R
Review Windows Batch processes
Write a Windows Batch process from R
Combinding the power of Batch files with R “For loops”
Use of an Anchor search term to enable comparative analysis of Trends data

Bringing it all together: Setting up the automated R process.

Automating a Google Trends data download.
Scheduling Trends Data Download using R script, .bat, and Task Scheduler

Section 4: Using gTrendsR package

Getting started with gTrendsR package
Use gTrendsR to download large amounts of data