How to: Detect languages in Google Sheet using =DetectLanguage()

You probably are already familiar with the GoogleTranslate function on Google Sheets. But did you also know that you are able to detect languages on Google Sheets? The language detection function works on cells or string in Google sheets. In this tutorial, you’ll learn how to use the function.

Usage

To use the GoogleTranslate function in Google Sheets, select the cell and type in the following formula.

=DETECTLANGUAGE(text_or_range)

The function will detect the language of the cell of string, and returns the language code. A language code is the shorter code for the language. In the first example, this is ‘en’, which stands for English. We’ve made an overview of all supported languages and their codes on this page about the Google Translate function.

Example 1: Detecting what language ‘Hello, world!’ is

=DETECTLANGUAGE(“Hello, world!”)

Example 2: Detecting what language cell A1 is

=DETECTLANGUAGE(A1)

Combine =DETECTLANGUAGE() with =GOOGLETRANSLATE()

The most interesting use case I came across is to use the language detection function with Google Translate. This way you are able to detect languages and automatically translate them to your own language.

Let’s say that you have a list of words or sentences of different languages that you want to translate to one. These could be comments in different languages on YouTube, or reviews of a product. For the example below I’ve written down some words in different languages in Column A. In column B there are the detected languages, as you can see in example 2 above. In cell C1 I use the Google Translate function, which looks like this:

=GOOGLETRANSLATE(text, [source_language], [target_language])

So by selecting A1 as text, B1 as source language and ‘en’ (English as targeted language. I’m able to automatically detect languages and translate them to English.

More efficient

You could also combine the formulas to be more efficient. by using the formula below. We want to both detect the language and translate cell A1. The target language is English (“en”). This way it’s more efficient and we need less cells.

=GOOGLETRANSLATE(A1,detectlanguage(A1),"en")

Sum up

That’s it! This is all you need to know to work with the DETECTLANGUAGE formula in Google Sheets. If you still have any questions, don’t hesitate and leave a comment down below. We’ll check all comments daily and try to help you out with your issues. Cheers!

Leave a comment

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