Goozak
Goozak

Reputation: 529

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.

Upvotes: 0

Views: 1564

Answers (2)

lanzalibre
lanzalibre

Reputation: 370

My workaround was to use the copyTo() method to move a sheet in a spreadsheet with the right settings to a new (just created) spreadsheet.

This way, the new spreadsheet inherits the settings.

Upvotes: 1

Eric Koleda
Eric Koleda

Reputation: 12673

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.

Upvotes: 2

Related Questions