访问“区域设置”对于Google表格 [英] Access the "Locale" for Google Sheets

查看:87
本文介绍了访问“区域设置”对于Google表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问文件>中设置的区域设置电子表格设置> Locale



Session.getActiveUserLocale()文件>电子表格设置>区域设置

- 其他信息

在电子表格设置中,您可以选择意大利作为您的语言环境。 Session.getActiveUserLocale()将返回en而不是it。

我的用例:我想知道函数何时应该写成;或,分隔其参数。 Google表格切换到;或当文件>时自动,电子表格设置>区域设置已更改。所以我想知道它正在观察哪些属性来进行此更改。

解决方案

我认为Session方法会获得关联的区域设置使用Google Apps脚本。要获取电子表格本身的区域设置,请使用电子表格 getSpreadsheetLocale()方法


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.

解决方案

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.

这篇关于访问“区域设置”对于Google表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆