Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda