Scrape Bing search into sheets

[BING] How to scrape Bing search results Google sheets.

In this article, we will see how o scrape Bing search results using Google sheets. The IMPORTJSON is a much more sophisticated function that the IMPORTXML function. This involves creating a custom search engine using google.

scrape bing search results using Google sheets

  1. Create a google custom search engine.
  2. Under sites to search, enter Bing.com
  3. Copy your search engine ID.
  4. Create a Google sheet.
  5. Go to tools-> script editor and paste the following code from https://www.aozata.com/importjson-gs/
  6. Get a google custom search API Key from here.
  7. Formulate your api key in this format.
    1. https://www.googleapis.com/customsearch/v1?key={YOUR_API_KEY}&cx={CUSTOM_SEARCH_ENGINE_ID}&q={KEYWORD}
  8. Enter the cx ID, API key, search query (q), API URL in different cells.
  9. Use the concatenate function to join all these 4 variables to get your final API URL
  10. Use the IMPORTJSON function to get the search results into the sheet.
    1. For title- =ImportJSON($D$9,“/items/title”,“noHeaders”)
    2. For URL- =ImportJSON($D$9,“/items/link”,“noHeaders”)
    3. FOr snippet- =ImportJSON($D$9,“/items/snippet”,“noHeaders”)
    4. For Image- =ImportJSON($D$9,“/items/pagemap/cse_image/src”,“noHeaders”)
    5. For meta description =IF(ISERROR(importxml(D12,“//meta[@name=’description’]/@content”)),“”,importxml(D12,“//meta[@name=’description’]/@content”))
  11. Here is a sample sheet that does this.