No-Code Enrichment with
Google
Use Google Custom Search API to Get Web Wearch Results in a Spreadsheet Using Custom Input Values
Sign Up Free

Google Custom Search API to Get Search Results in a Spreadsheet

Google Custom Search allows you to run web search queries with Google based on a custom search query. You can run up to 100 per day. Note that as a prerequisite you need to have created a Google Custom Search Engine with “Search the entire web” chosen.

https://programmablesearchengine.google.com/controlpanel/create 

Google Custom Search API Docs

Provider Website: https://developers.google.com/custom-search/v1/

Provider Enrichment Docs: https://developers.google.com/custom-search/v1/introduction

Endpoint: curl 'https://customsearch.googleapis.com/customsearch/v1?q=QUERY&key=APIKEY&cx=SEARCHENGINEID'

Token / Registration Required: Yes

How To Enrich A Spreadsheet With Google Search:

For this example, I will be doing a web search to find sites that list vendors for different industries. My data is a list of industries pulled from NAICS, with the industry name and NAICS code in one column.

Step 1. In Gigasheet, head to the Enrichments function and select Custom Enrichment. First we paste in the HTTP request from the Google Documentation and add in my API key with the “key=” parameter and the search engine ID of my Google Custom Search engine with the “cx=” parameter.

Google Custom Search API request with Keys added

Step 2. On the next screen we’ll modify the query and insert the column variable from our Gigasheet sheet. In this case, I want to search for “top vendors for x”. So first I use https://www.urlencoder.org/ to encode that to “top%20vendors%20for%20x”.

Use URL Encoder to help customize Google Custom Search API

Now copy and paste the "top%2020%20vendors%20for%20x".

Encoded URL request for Google Custom Search API

Then I highlight “x” and replace it with the input column “line” by choosing the column and clicking  +Insert Column Reference. 

Merging spreadsheet values into Google Custom Search API
Merge field applied to Google Custom Search API

Then click Next.

Step 3. In this screen we see a preview of the results. Gigasheet makes requests for the first three rows and shows the Google Search API response. At this point select the fields you want to be inserted into your sheet. I’ll choose “items/0/link”, “items/0/snippet”, and “items/0/title” for the link, snippet, and title of the first search result. If you wanted additional search results, you could choose the fields from “items/1” and so on.

Preview of response to Google Custom Search API

Step 4. Finally, confirm the number of requests is to your liking, and when ready click Run to kickoff the custom enrichment process. It’s ok to leave or close the sheet; the custom enrichment will keep running and you’ll receive an email once the job has been completed. You can monitor the progress of your enrichment, or cancel the job at the top of the sheet. 

Confirm execution of Google Custom Search API

Step 5. Once completed, Gigasheet will send a completion message and refresh the page. The result will show generation of new columns based on Google Custom Search. We’ve added links, titles, and snippets for the top search result for each industry.

Spreadsheet enriched with Google Custom Search API data
Try it Out

The ease of a spreadsheet with the power of a database, at cloud scale.

No Code
No Database
No Training
Sign Up, Free Forever