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

About brucemcp 225 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.