このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 2024.01.18 SSL Error in Rails created
- 2024.01.18 RailsでSSLエラー 以前のリビジョンを復元 (2024/01/18 07:06)
- 31 CentOS5 TLS1.2 created
- 2024.04.12 MySQL BIT Field created
最近の更新
GASのグローバル変数は、参照はするけど変更を保存しておくことができない。
このようにすると、永続化してカウントし続ける事ができます。
var scriptProperties = PropertiesService.getScriptProperties(); var count = scriptProperties.getProperty('count'); function loadCount(){ var count = scriptProperties.getProperty("count"); if (!count) return 0; count = Number(count) + 1 return count; } function saveCount(count) { scriptProperties.setProperty("count", count); } function main(){ var count = loadCount(); Logger.log('count ' + count); saveCount(count); }