DETECTLANGUAGE in Google Sheets: Identify Text Language
Use DETECTLANGUAGE in Google Sheets for individual text cells, understand its one-column range rule and build a language-review list without assuming majority voting.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =DETECTLANGUAGE("Bonjour, je cherche la gare.") is expected to identify French and return fr. This is a language-classification expectation, not a result observed in a live Sheets session.
Syntax and returned value
=DETECTLANGUAGE(text_or_range)
The Google DETECTLANGUAGE reference accepts text or a reference containing text and returns a language code. Its English documentation specifies a one-dimensional column range when a range is supplied.
There are no optional language hints, confidence thresholds or output-format arguments. Put literal text in double quotes; use an unquoted cell address to evaluate that cell’s contents.
Google’s documented mixed-language rule is important: the function evaluates the first text it finds. A range is not a request for a frequency table, majority language or separate code for every row.
Worked example: identify each message separately
Enter this synthetic, non-sensitive text:
| Cell | Text | Expected language code |
|---|---|---|
| A2 | Bonjour, je cherche la gare. | fr |
| A3 | Hello, I am looking for the station. | en |
| A4 | Hola, estoy buscando la estación. | es |
In B2, enter:
=DETECTLANGUAGE(A2)
Fill the formula down to B4. Each copied formula now refers to its own row, so the expected output is fr, en, es in separate cells.
These full sentences have clear language identities. The codes and intended meanings can be checked independently, but the service’s actual classifications and future model behavior were not executed or guaranteed here. Treat the table as a reproducible test case, not a permanently fixed service response.
Why a range is different
With those same cells, compare:
=DETECTLANGUAGE(A2:A4)
The documented first-text rule makes fr the expected single result. Even if ten English sentences followed the French sentence, that would not turn this range call into a majority vote.
If the business question is “Which language appears most often?”, first classify individual rows and then count the resulting codes. Do not infer a column’s distribution from a single range call.
The reference does not establish a general traversal order for arbitrary rectangular ranges; the guide uses the documented single-column shape. Blank-only, numeric-only and mixed nontext behavior were not established and should not be used as hidden selection rules.
Advanced application: count and route messages for review
After B2:B4 contains the expected codes, count French rows with:
=COUNTIF(B2:B4,"fr")
Expected count for this example: 1. A simple review label in C2 is:
=IF(B2="en","English review","Other-language review")
Fill it down. The expected labels are Other-language review, English review, and Other-language review. These labels are your spreadsheet logic; DETECTLANGUAGE itself returns the code rather than a routing decision.
Keep the source text beside the code so a reviewer can correct uncertain classifications. A language tag alone does not establish the author’s nationality, residence or preferred language for future contact.
For occasional blank rows, a blank-preserving formula is:
=IF(A2="","",DETECTLANGUAGE(A2))
The intended blank-row output is an empty string. This is a worksheet guard, not a claim about DETECTLANGUAGE’s native behavior on empty text.
Detection and translation are separate steps
GOOGLETRANSLATE translates text and accepts an explicit source code or "auto". DETECTLANGUAGE supplies an inspectable classification before translation; it does not translate or validate meaning.
For a multilingual review list, retaining the original text, proposed code and human correction in separate columns makes mistakes visible. If the source language is already known reliably, there may be no reason to detect it again.
Troubleshooting and limitations
- Use meaningful text. Names, abbreviations, product codes and short shared words may not provide enough context for your intended classification.
- Check that the formula refers to the message cell rather than a header or neighboring identifier.
- Classify rows individually when several languages occur in one column.
- Review mixed-language sentences manually instead of treating one returned code as a full description.
The reviewed reference does not document confidence scores, a complete error-token matrix, exact service quotas or a guaranteed processing time. Do not invent those limits or replace an error with a language code that was never returned.
Availability and verification
DETECTLANGUAGE is documented for current rolling Google Sheets. Portability to another spreadsheet product, original introduction date and first or last functioning numbered releases were not established.
NOT_TESTED_IN_GOOGLE_SHEETS. Individual Google documentation was inspected on October 17, 2026. The original sentences were independently identified linguistically; code counts and review labels were independently checked. No live detection, account access or screenshot is claimed.