Easy Way To Scrape Google Search Results And Auto-update The Data

How to scrape Google Search results
Reading Time: 7 minutes

In this article, we’ll learn how to scrape Google Search results and automatically pull the data to Google Sheets. We can scrape data such as titles, links, and snippets among other things–all without a single line of coding.

In the snippet below, you can see the page title, link and snippets for the keyword that we’ve scraped from Google Search and imported into Google Sheets.

Google Search results pulled to Google Sheets

Scraping the Google Search results page can quickly and easily be done using a simple Google Sheets extension called Amigo. With Amigo we can scrape Google Search results without a single line of coding and set it to retrieve the Google Search results periodically. We only need to specify the search keyword and Amigo will fetch us the latest results for that query without any additional manual input.

Scraping Google Search results with Amigo is a cakewalk–and, may we say, a cake feast because it’s fun! So without further ado, let’s begin.

Steps to scrape Google Search results:

  1. Install the Amigo extension
  2. Get the API endpoint URL
  3. Import the data to Google Sheets

How to scrape Google Search results

Install the Amigo Data extension in Google Sheets

Install the Amigo Data Google Sheets add-on from the Google Workspace Marketplace by clicking the link below to scrape Google Search results.

Install Amigo to scrape Google Search results

Alternatively, you can get it from Google Sheets.

  • Open Google Sheets
  • Go to Extensions→Add-ons→Get add-ons
  • Search for Amigo and install it.

Get the Google Search API endpoint URL

We’ll use a Google Search scraper API on RapidAPI–an API marketplace–to scrape Google Search results and pull the search results to Google Sheets.

Sign up or log in to RapidAPI.

Search for Google Search API and click the most relevant one from the results. or visit the Google Search API documentation page.

Google Search API in RapidAPI Hub

Click on the Subscribe to Test button and subscribe to a plan of your choice, post which you’ll be able to use the Google Search API to scrape Google Search results and import the search results to Google Sheets.

Subscribe to the Google Search API

Click Endpoints to go back to the Google Search API documentation. On the left is the list of the type of search results that we can scrape–web and image.

Available endpoints in Google Search API

We can scrape either web search results or images. The method is the same for both. We’ll scrape Google Search results for web search. Click the Web Search endpoint.

Under Required Parameters in the query field, enter the keyword that you want to scrape Google Search results–eg. metaverse. You can also use a combination of words as a query.

Entering the search keyword to scrape Google Search results

Then fill in the optional parameters to filter the search results. These parameters are however, as the name suggests, not required. In the example below, the region is set to US, and will return the top 20 results in English sorted by relevance.

Optional parameters

After filling in the parameters, click the Test Endpoint to run the query and verify whether the API is working. If it is, then we should see the results returned in JSON format.

In the Code Snippets section, we’ll find the Google Search API endpoint URL along with the parameters and the headers.

Change the language to Shell→cURL from (Node.js) Axios. The query parameters are appended in the URL so that we do not have to enter the parameter manually to pull the Google Search results to Google Sheets.

Google Search API endpoint URL and headers

Copy the URL and also note the headers. These will be used to scrape Google Search results and import the search results to Google Sheets.

Import the Google Search results to Google Sheets

Open Google Sheets and launch Amigo to retrieve the Google Search results and pull the data to Google Sheets. To connect to Amigo, click Extensions→Amigo→Connect.

Launch Amigo to scrape Google Search results

We’ll be presented with a list of sources to connect and import data. Select Custom API.

Select Custom API as the source to connect

Enter the API endpoint URL in the API URL field. Make sure that the apostrophes are not included while copying the URL; otherwise the API won’t work.

Entering the Google Search API URL

Then expand the Details tab and enter the headers mentioned in the Code Snippets. The characters to the left of the colon are the header names and those to the right are the header values. Enter these as separate headers. Do not include the apostrophes.

Name: X-RapidAPI-Host, Value: google-search72.p.rapidapi.com

Name: X-RapidAPI-Key, Value: YOUR_API_KEY

Entering the Google Search scraper API headers
Preview of the Google Search results to import to Google Sheets

The Google Search results will be imported into Google Sheets in a moment. Below is a snippet of the Google Search results imported into Google Sheets.

Google Search results imported into Google Sheets

Automatically fetching Google Search results to Google Sheets

Once we’ve scraped the Google Search results and imported the search results to Google Sheets, we can let Amigo do the heavy lifting of automatically updating the search results.

FAQs

How can I scrape Google search results for a specific location or language?

How can I handle pagination when scraping Google search results?

How do I automatically scrape Google Search results?

Some recommended articles:

How To Scrape And Import Google News Data To Google Sheets

Import LinkedIn Profile Data To Google Sheets

Connect Hubspot To Google Sheets

Leave a Reply

Discover more from Amigo: No-code Data Integrations to Google Sheets

Subscribe now to keep reading and get access to the full archive.

Continue reading