Access the “Locale” for Google Sheets

2019-07-21 11:27发布

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.

1条回答
叼着烟拽天下
2楼-- · 2019-07-21 11:57

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.

查看更多
登录 后发表回答