Google Apps 脚本:如何在不同的函数调用之间将数据保存在电子表格中? [英] Google apps script: how to persist data in spreadsheet between different function calls?

查看:15
本文介绍了Google Apps 脚本:如何在不同的函数调用之间将数据保存在电子表格中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用脚本编辑器的 Google 电子表格中,我执行函数调用,但我不太确定存储持久数据(我将继续使用的数据)的最佳方法是否是使用全局变量(使用对象、数组), 字符串),或者有更好的方法来存储数据.

In a Google spreadsheet using the Script Editor, I do function calls, but I am not quite sure if the best way to store persistant data (data that I will continue to use) is to use global variables (using objects, arrays, strings), or there is a better way to store data.

我不想使用可能是另一种方式的单元格.

I don't want to use cells which could be another way.

另一个问题,在这种环境下是否可以创建(伪)类?最好的方法?

Another question, is it possible to create (pseudo) classes in this environment? Best way?

推荐答案

可以使用 Class ScriptProperties 存储持久性数据:

Persistent data can be stored using the Class ScriptProperties:

http://code.google.com/googleapps/appsscript/class_scriptproperties.html

所有值都存储为字符串,并且在检索它们时必须使用 likes 或 parsInt 或 parseFloat 转换回来.

All values are stored as a string and will have to be converted back with the likes or parsInt or parseFloat when they are retrieved.

JSON 对象也可以以这种方式存储.

JSON objects can also be stored in this manner.

这篇关于Google Apps 脚本:如何在不同的函数调用之间将数据保存在电子表格中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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