What does Google Autocomplete show all over the world ?

It turns out there is a kind of API – suggestqueries.google.com – that you can use to programatically get what Google autocomplete shows when you use search.

You know the kind of thing…

It’s well known that you would get different results depending on where you were. I wondered if you could automate this, but suggestqueries.google.com only exists as a .com. However I discovered that if you change the language, you get different answers, so here we go – a simple custom function in Google Spreadsheets, a list of all known languages, and some query.

You can take a copy and play with it here.

The details

Language list

I have a sheet with about 200 languages on it. If you know other official codes let me know and i’ll add them. It looks like the list on the left

Custom function

This will execute the suggestion, pretending to be in the given language code.

function suggest(query,language) {
  var url = ‘http://suggestqueries.google.com/complete/search?client=chrome&hl=’ +  
            (language language : ‘en-us’ ) + 
            ‘&q=’ + encodeURIComponent(query);

  return JSON.parse(UrlFetchApp.fetch(url).getContentText())[1];

}

Back in the spreadsheet we have this formula in each cell in column B. Column A has a validation list based on all known languages.

=suggest($B$1,vlookup(A3,languagelist!A:B,2,false))


For more stuff like this see Excel Liberation

(function() { var po = document.createElement(‘script’); po.type = ‘text/javascript’; po.async = true; po.src = ‘https://apis.google.com/js/plusone.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(po, s); })();

Author: bm082975

Leave a Reply

Your email address will not be published. Required fields are marked *