Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
How to know whether a cell contains Gujarati or English letters?

If the contents of the cells in Google sheet are as per the below image:

enter image description here

Then in Apps Script, how can we check whether it includes Gujarati letters or not.

function containsGujaratFont() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("SheetNameToWriteHere");
  var vals = sheet.getRange("B1:B3").getValues();
  vals.forEach(r => {
    Logger.log(includesGujaratiFont(r[0]));
  });
}

function includesGujaratiFont(str){
  // some coding to identify if str contains Gujarati characters or not
  if(itContainsGujaratiFont){
    return true;
  }else{
    return false;
  }
}

The log should be:

true
false
true
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

For example, when this information is used, it is considered that the range of Unicode is \u0A80-\u0AFF. When this range is used in your script, it becomes as follows.

Modified script:

In this case, your function of includesGujaratiFont is modified.

function includesGujaratiFont(str){
  return /^[\u0A80-\u0AFF]+$/.test(str);
}
  • In this modification, when all characters in a cell value are Gujarati, true is returned.

  • If you want to return true, at least when one of the characters in a cell value is Gujarati, please modify as follows.

    • From

        return /^[\u0A80-\u0AFF]+$/.test(str);
      
    • To

        return /[\u0A80-\u0AFF]/.test(str);
      

References:

  • Gujarati (Unicode block)
  • test()
about 4 years ago · Juan Pablo Isaza Denunciar

0

You do not need to use app script to do this. You can use the DETECTLANGUAGE funtion within google sheets.

If you enter the following formula into cell B2, where your text is in A2, the formula will then output GU for Gujarati.

=detectlanguage(A2)    

The only limitation on this function is if the cell contains two lanagaues i.e. Gujarati and English it will only work for the first text element

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda