Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access the "Locale" for Google Sheets

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.

like image 860
Don P Avatar asked May 21 '15 23:05

Don P


1 Answers

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.

like image 101
AdamL Avatar answered Nov 01 '22 04:11

AdamL