【问题标题】:Custom function substring Apps Script自定义函数子字符串 Apps 脚本
【发布时间】:2021-04-02 00:46:18
【问题描述】:

我正在尝试将子字符串方法集成到自定义函数中,但出现错误。我的功能很简单:

Var num = "1234567"
Var num2 = Num.slice(0,2)

我无法让它在我想用作公式的自定义函数中运行。

【问题讨论】:

  • 自定义函数有一些限制。
  • 你能提供整个脚本来复制你的问题吗?关于I can't make it run inside a custom function that I want to use as a formula.,我能问一下你当前问题的细节吗?

标签: javascript google-apps-script google-sheets substring custom-function


【解决方案1】:

Google Apps Script /JavasScript 区分大小写。

  1. 使用var 而不是Var
  2. 您的代码将变量声明为 num 没有 Num

【讨论】: