0

我有以下函数返回一个行数组:

/**
 * Returns the names of people
 * @customfunction mynames
 * @param invocation Custom function handler
 */
function mynames(invocation: CustomFunctions.StreamingInvocation<string[][]>): void{
  const timer = setInterval(() => {
    var row1 = ["larry", "moe", "curly"];
    var row2 = ["scoopy", "velma", "shaggy"];
    var rows = [row1, row2];

    invocation.setResult(rows);
  }, 5*1000); // every 5 seconds

  invocation.onCanceled = () => {
    clearInterval(timer);
  };
}

在 Excel 上完美运行,我得到:

larry   moe curly
scoopy  velma   shaggy

但是,Excel for Windows 只给了我larry. 在 Excel for Windows 中似乎不尊重溢出。

事实上,他们在文档中明确给出的示例具有相同的行为,并且在 Windows 版本的 Excel 上也被破坏了。我认为它们在 Mac 版本上也被破坏了。

4

1 回答 1

0

您将需要使用支持动态数组的 Excel 版本。否则,您可以手动输入数组(ctrl+shift+将公式输入到要溢出的所需单元格中)。

这目前在 Windows 的每月/“当前”频道中可用,并将在本月推出的半年度更新中可用。

截至 2020 年 1 月的最新 Mac 版本也应该会溢出。

希望有帮助。

于 2020-07-03T02:29:19.017 回答