Search code examples
google-apps-scriptgoogle-sheetslocale

How do I use Spreadsheet.setSpreadsheetLocale?


I'm trying to change the Locale for my spreadsheet, but setSpreadsheetLocale doesn't seem to work.

If I do

var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.setSpreadsheetLocale('en_AU');
Browser.msgBox(ss.getSpreadsheetLocale());

the message box displays the correct locale, but the format of the dates in the sheet doesn't change. Also, 'File', 'Spreadsheet settings...' still displays the previous locale. And if I close the spreadsheet and reopen it, it is still in the original locale.

Is it something I'm doing wrong, or is it a bug?

EDIT following Serge insas comment : Indeed, refreshing the page (F5) does update the display using the new Locale.


Solution

  • It seems that the spreadsheet doesn't respect the new locale setting until you refresh the page, while changing it in the UI causes it to go into effect immediately. You can open a bug report on the issue tracker to track this issue.