SOLVED

Reliable way to determine the argument separator of Excel formulas

Brass 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 (Brass 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.

1 best response

Accepted Solutions
best response confirmed by Tie CHENG (Brass 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.

View solution in original post