SOLVED

Reliable way to determine the argument separator of Excel formulas

%3CLINGO-SUB%20id%3D%22lingo-sub-2600012%22%20slang%3D%22en-US%22%3EReliable%20way%20to%20determine%20the%20argument%20separator%20of%20Excel%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2600012%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20we%20develop%20Excel%20add-ins%20by%20JavaScript%20API%2C%20we%20need%20to%20determine%20the%20argument%20separator%20of%20Excel%20formulas.%20For%20some%20environments%20it%20is%20%60%2C%60%20(comma)%3B%20for%20some%20environments%20it%20is%20%60%3B%60%20(semicolon).%20I%20don't%20know%20if%20there%20are%20other%20possibilities.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20seems%20that%20there%20is%20no%20an%20Excel%20JavaScript%20API%20to%20get%20that%20directly%2C%20please%20correct%20me%20if%20I'm%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20possibility%20is%20to%20get%20the%20language%20of%20the%20user.%20But%20where%20can%20we%20find%20a%20match%20table%20of%20language%20and%20the%20argument%20separator%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20have%20a%20reliable%20way%20to%20get%20this%20information%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2600012%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2600157%22%20slang%3D%22en-US%22%3ERe%3A%20Reliable%20way%20to%20determine%20the%20argument%20separator%20of%20Excel%20formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2600157%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F113332%22%20target%3D%22_blank%22%3E%40Tie%20CHENG%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20might%20get%20the%20decimal%20separator%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20systemDecimalSeparator%20%3D%20context.application.cultureInfo.numberFormat.numberDecimalSeparator%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIf%20it%20is%20a%20point%2C%20the%20list%20(argument)%20separator%20will%20be%20comma%3B%20if%20it%20is%20a%20comma%2C%20the%20list%20separator%20will%20be%20semi-colon.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hello,

 

When we develop Excel add-ins by JavaScript API, we need to determine the argument separator of Excel formulas. For some environments it is `,` (comma); for some environments it is `;` (semicolon). I don't know if there are other possibilities.

 

It seems that there is no an Excel JavaScript API to get that directly, please correct me if I'm wrong.

 

Another possibility is to get the language of the user. But where can we find a match table of language and the argument separator?

 

Does anyone have a reliable way to get this information?

 

3 Replies
best response confirmed by Tie CHENG (Contributor)
Solution

@Tie CHENG 

You might get the decimal separator:

const systemDecimalSeparator = context.application.cultureInfo.numberFormat.numberDecimalSeparator;

If it is a point, the list (argument) separator will be comma; if it is a comma, the list separator will be semi-colon.

@Hans Vogelaar 


"If it is a point, the list (argument) separator will be comma; if it is a comma, the list separator will be semi-colon." ==> are you really sure that it is always the case?

@Tie CHENG 

I've never seen an exception.