gpt4 book ai didi

performance - Google apps 脚本 - 加速 getActiveDocument()?

转载 作者:行者123 更新时间:2023-12-02 04:02:41 25 4
gpt4 key购买 nike

我正在编写一个脚本,用于将 Google 文档中的选定文本设置为大写。该脚本工作正常,但在大型文档中速度非常慢。因此,我剥离了几乎所有内容来执行一些速度测试,我意识到这个简单的行:

      var document = DocumentApp.getActiveDocument();

执行 150 页文档需要 9-10 秒。

有没有办法加快这个过程,即预先缓存“文档”,以便当我调用脚本时我可以使用我的 getCursor()getSelection()在合理的时间内?

最佳答案

您无法预缓存此内容。为缓存提供的服务有:

  • CacheService:仅存储字符串值
  • ScriptDB:无法在此存储文档。

所以我担心你需要应对它。

关于performance - Google apps 脚本 - 加速 getActiveDocument()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20121427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com