7

How can I access the "Locale" set in File > Spreadsheet Settings > Locale?

Session.getActiveUserLocale() does not match the value chosen in File > Spreadsheet Settings > Locale.

- Extra Info -

Reproduce: In Spreadsheet Settings, you can choose "Italy" for your Locale. Session.getActiveUserLocale() will return "en" instead of "it".

My use case: I am trying to know when a function should be written with ";" or "," separating its parameters. Google Sheets switches to ";" or "," automatically when File > Spreadsheet Settings > Locale is changed. So I want to know what property it is watching to make this change.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Don P
  • 60,113
  • 114
  • 300
  • 432
  • Can you please explain how you determine a "separator" if you know spreadsheet locale? Is there a gas function? – Ivan Gusev Feb 04 '20 at 13:15

1 Answers1

4

I think the Session method will get the locale associated with the Google Apps Script. To get the locale of the spreadsheet itself, use the Spreadsheet getSpreadsheetLocale() method.

AdamL
  • 23,691
  • 6
  • 68
  • 59