How to determine which formulas separator is used?

44 views
Skip to first unread message

Alex

unread,
Oct 11, 2019, 2:22:52 PM10/11/19
to Google Apps Script Community

I'm truing to detect which formulas separator is used.

Has someone solved this problem?

At now I use my own i18n implementation like this

var _translations_ = {
  separator
: {
    en
: ',',
    ru
: ';',
    uk
: ';'
 
}
};


var formula = Utilities.formatString(
 
'HYPERLINK(%s%s%s)',
  url
,
  i18n
.getMessage('separtor'),
  linkLabel
);
range
.setFormula(formula);

Mael Caldas

unread,
Oct 12, 2019, 6:38:13 AM10/12/19
to Google Apps Script Community
Hi Alexander,

I had a similar problem. The only way I've found was verifying every location on Spreadsheet settings and flagging the ones that uses comma (,) as separators. The list I've found was:


 COMMA_LOCALES
= ["en_US", "en_AU", "en_CA", "zh_CN", "ar_EG", "zh_HK", "hi_IN", "bn_IN", "gu_IN", "kn_IN", "ml_IN", "mr_IN", "pa_IN",  "ta_IN", "te_IN", "en_IE", "iw_IL", "ja_JP", "es_MX", "mn_MN", "my_MM", "fil_PH", "ko_KR", "de_CH", "zh_TW", "th_TH", "en_GB",  "cy_GB"];



All other ones uses ';'

Then check against 


 
Spreadsheet.getSpreadsheetLocale();

Alex

unread,
Oct 14, 2019, 9:35:34 AM10/14/19
to Google Apps Script Community
@Mael 

You are the best! Thanks! Can I share this as a standalone repo?

Mael Caldas

unread,
Oct 14, 2019, 10:02:56 AM10/14/19
to google-apps-sc...@googlegroups.com
Sure :-)

Cheers
Mael

--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/NTRXOQeYXtE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/78e8cee5-1358-459a-805a-4e5f4471bfc2%40googlegroups.com.

Alex

unread,
Oct 15, 2019, 2:16:04 PM10/15/19
to Google Apps Script Community
OK. There is what I done https://github.com/hedgehogsburrows/google-sheets-formulas-separator/blob/develop/dist/separators.js

This is simple code to define a  separator if you know the locale code.

@Mael thanks again
Reply all
Reply to author
Forward
0 new messages