Google Sheets does not have a function named DETECTLANGUAGE. The function that detects the language of text is DETECTLANGUAGE(text) with a trailing E — type it exactly that way — and it returns a two-letter language code such as en, es, de or fr. If you typed DETECTLANGUAGE without the E, Sheets treats it as an unknown name and returns #NAME?, which is the single most common reason people think the function does not exist. Once spelled correctly, it needs no setup: put the text in a cell and call the function on that cell reference.
What You'll Need
- A Google account with access to Google Sheets in a web browser (the function is typed into a cell like any other formula).
- Text to analyse, ideally in its own column, one value per row.
- Enough text to be meaningful — the function works on short strings but is far more reliable on a full sentence than on a single word.
- No add-on, no API key and no paid plan. DETECTLANGUAGE works on free personal Google accounts as well as Workspace accounts.
Step-by-Step
- Open your spreadsheet at sheets.google.com and click into the tab that holds your text. If the text you want to check sits in column A starting at row 2, click cell B2 to place the formula beside it.
- Type the function name carefully. In B2 enter
=DETECTLANGUAGE(A2)and press Enter. Watch the autocomplete dropdown as you type: if the only suggestion looks nothing like a language function, you have misspelled it. - Read the result. The cell returns a short lowercase ISO language code, not the language name. "en" is English, "es" Spanish, "fr" French, "de" German, "pt" Portuguese, "it" Italian, "ja" Japanese, "zh-CN" or "zh-TW" for Chinese variants, and so on. Codes with a region or script suffix are normal — that is the function being more specific, not an error.
- Wrap it in IFERROR while you build the sheet. Change the formula to
=IFERROR(DETECTLANGUAGE(A2),"unknown"). Blank reference cells, numbers-only cells and unsupported scripts can all produce errors, and this keeps the column tidy so a single bad row does not stand out as #VALUE!. - Fill the formula down. Click B2, grab the small square at the bottom-right corner of the selection and drag down to the last row of data, or double-click that square to fill automatically to the end of the neighbouring column. Every row now gets its own detection.
- Handle blanks deliberately. If some rows are empty, the function may return an error or a misleading guess. Use
=IF(A2="","",IFERROR(DETECTLANGUAGE(A2),"unknown"))so empty rows stay genuinely empty. - Turn codes into readable names if you need them. Build a small lookup table on a second sheet — one column of codes, one column of language names — and pull the name with VLOOKUP or XLOOKUP against the code column. There is no reliable built-in function that returns the full language name, so a lookup table you control is the practical route.
- Test against known text. Paste one sentence each of two or three languages you can identify yourself into spare cells and point the formula at them. If the codes come back swapped or wrong, the cause is almost always short text rather than a broken formula.
Menu and function labels can differ slightly by version, region and account type, but DETECTLANGUAGE itself has been stable in behaviour for a long time. On mobile, the same formula works in the Sheets app, but typing it is fiddly — enter it on desktop and it will be there on your phone.
Common Mistakes
- Spelling it DETECTLANGUAGE. That is not the name. It is DETECTLANGUAGE. Sheets returns #NAME? for any unknown function, and the error text is easy to skim past.
- Passing quoted text instead of a reference.
=DETECTLANGUAGE("bonjour")is valid but useless in bulk; put the text in a cell and reference it. - Expecting a language name. The function returns codes only. "French" will never appear unless you build the lookup.
- Detecting from a single word. One word is often shared across languages — "hotel", "radio", "piano" — and the result can flip unexpectedly. Detect from a sentence or paragraph whenever you can.
- Forgetting that the sheet recalculates. The formula is not a snapshot; it recalculates when the input changes. If you edit the source text, the result updates and may no longer match what you recorded elsewhere.
- Using the code as a filter value without trimming. Extra spaces around the text can affect detection. Wrap the reference in TRIM before feeding it in:
=DETECTLANGUAGE(TRIM(A2)).
Tips
- Detect from the longest clean sample you have. A full paragraph gives far more reliable results than a name or a product title.
- If you need to detect many rows at once, keep the formula in one helper column and copy the values into a static column when you are done, so the results do not change under you later.
- Use conditional formatting on the code column to colour rows by language — it makes mixed-language contact lists or review exports much easier to scan.
- Combine with a lookup table for regional variants. When you see zh-CN versus zh-TW, decide in advance whether you treat them as one language or two.
- For sorting and grouping, sort on the code column, not on the original text column, then re-sort alphabetically inside each group if needed.
- If you are cleaning imported data, run DETECTLANGUAGE first and review the odd-looking rows before translating anything — cheap to check, expensive to undo.
Troubleshooting
#NAME? in every cell. The function name is misspelled or the sheet is using a locale that expects a different separator. Check the spelling first, then try a semicolon instead of a comma between arguments if your region uses that convention.
#VALUE! or an error in isolated rows. The referenced cell is blank, contains only numbers or punctuation, or holds text the service does not support. Wrap with IFERROR and review those rows manually.
A whole column returns nothing. Confirm the reference actually points at text and not at an image, a checkbox, or a formula that resolves to a blank string. Point the formula at a hand-typed sentence to prove the formula itself works.
Results that look wrong. Short text is the usual culprit; lengthen the sample. Romanised text, mixed-language sentences and names are inherently ambiguous, and no detector gets those right consistently.
If that did not work, copy the text into a fresh sheet and test there. If it still fails, check that the file is a genuine Google Sheets file rather than an Excel file open in compatibility mode, since some functions behave differently in imported files. As a last resort, re-enter the formula from scratch rather than editing it, which clears stray invisible characters.
Frequently Asked Questions
Is the function called DETECTLANGUAGE or DETECTLANGUAGE?
Google Sheets includes a function named DETECTLANGUAGE, with the final E. If you are searching for a language-detection feature in Sheets generally, that is the one to look for, and it should be typed exactly as it appears in the autocomplete list.
What languages does it support?
It covers the major languages the underlying Google translation service recognises, which is a broad set including most European, Asian and Middle Eastern languages. Very small or historical languages, romanised transliterations and mixed-script text are unreliable, so verify any edge case yourself.
Does it work on numbers or emoji?
No. Numbers, symbols and emoji carry no language signal, so the result is an error or a meaningless guess. Wrap the formula in IFERROR and exclude rows that contain no letters.
Can I get the language name instead of the code?
Not directly. The function returns ISO codes only. Build a two-column lookup table of code to name on a helper sheet and use VLOOKUP or XLOOKUP to display the name beside each result.
Why do I see zh-CN and zh-TW instead of just zh?
Chinese is split by script and region, so the function returns the more specific variant when it can tell them apart. Treat both as Chinese unless your workflow genuinely needs to separate them.
Does it translate the text?
No. It only identifies the probable language. Translation is a separate function, and translation output should always be reviewed before you rely on it for anything important.