How to change Google Apps Script locale?

google-apps-script, google-apps-script-editor

Solution

If you created the script from within a spreadsheet -- by selecting `Tools --> Script Editor` within the Sheets UI, then executing `setSpreadsheetLocale()` on the spreadsheet should apply your locale setting to the script, too.

If you created the script as a new document from Drive, then your suspicion appears to be correct -- there is no user-visible locale setting for a Script Document, so you'll have to create the script with an English-locale account.

You can refer to the official documentation for more info.

Problem

I created a Google Apps Script on the Google account, which had the Polish language set in the settings. Executing the script was causing some Google error message about exceeding quote Gmail rateMax, which was displayed in Polish. I shared this script with another account, where language was set to English in account settings. To my surprise, executing the script on the account where language was set to English, caused the error message to still appear in Polish. Question: how can I change the 'locale' of the Google Apps Script? Is it even possible? Or is the only option to create new script on the account with English locale, and copy over the code?

Original source