使用Google Sheets API创建持久值的方法有哪些?

问题描述

我正在编写Google表格google脚本程序。多个PropertiesService调用获取我想存储在某个地方并稍后访问的数据(无需再次调用UrlFetch)。我已经尝试了多种方法来保存信息,而不仅仅是一次运行函数。根据我的研究:

    每次调用函数时,.gs文件中的
  • 全局变量都会重新定义。不适合存储持久值
  • import React,{useEffect,useRef} from 'react'; import {AppState} from 'react-native' export default () => { const appState = useRef(AppState.currentState); var interval const _handleAppStateChange = (nextAppState) => { if ( appState.current.match(/inactive|background/) && nextAppState === "active" ) { console.log("App has come to the foreground!"); //clearInterval when your app has come back to the foreground BackgroundTimer.clearInterval(interval) }else{ //app goes to background console.log('app goes to background') //tell the server that your app is still online when your app detect that it goes to background interval = BackgroundTimer.setInterval(()=>{ console.log('connection status ',socket.connected) socket.emit('online') },5000) appState.current = nextAppState; console.log("AppState",appState.current); } useEffect (() => { AppState.addEventListener("change",_handleAppStateChange); return () => { AppState.removeEventListener("change",_handleAppStateChange); }; },[]) } 允许存储文本字符串...但是我的数据很快就超过了它。
  • 因此,我开始将数据存储在电子表格内的表格中,并且我认为我的数据也超出了电子表格文件(过去第15个标签,所以当我尝试再次运行函数时遇到异常)。 [有没有一种方法获取文件的大小? -只是我可以验证是否达到了500万个单元数限制?]
  • 我接下来要做的就是在Google云端硬盘上创建文件

这是前进的道路吗?您认为我应该将数据存储在另一个电子表格文件中还是文本文件中? JSON文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)