Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!