SoftTimur
SoftTimur

Reputation: 5540

Official API or way to get the current separator setting (e.g., `,` or `;`) of Excel formulas

As there are already more than 1000 Office JavaScript APIs, I would like to know if there is an official API or way to get the current separator setting (e.g., , or ;) of Excel formulas.

Determining it from a formula is not always possible, for example, in a workbook without any formulas.

Upvotes: 1

Views: 142

Answers (1)

Raymond Lu
Raymond Lu

Reputation: 2236

Unfortunately, Office JS Excel API currently doesn't have API to get separator for the formulas based on the locale. therefore, I would suggest that you could submit the request and upvote this request at uservoice

But to unblock your scenario, you could consider a workaround, detect the locale using cultureInfor.name from cultureInfo and figure out separator accordingly.

Here is the sample code for your reference:

  await Excel.run(async (context) => {
    var app = context.workbook.application;
    var ci = app.cultureInfo;
    ci.load("name");
    await context.sync();
    var seperator;
    if (ci.name = "en-US")
      seperator = ","
    else if (ci.name = "de-DE")
      seperator = ";"
    // continue determine the separator by other locale

    console.log("Culture: " + ci.name + " and Seperator: " + seperator);
  });

Upvotes: 1

Related Questions