带有 RichTextValue 变量的应用程序脚本 appendRow

App script appendRow with RichTextValue variable

尝试使用具有多个值的应用程序脚本附加行,其中之一是 RichTextValue 变量。

    var richValue = SpreadsheetApp.newRichTextValue()
   .setText('link')
   .setLinkUrl('www.somesite.com')
   .build();

sheet.appendRow([varX,varY,varZ,richValue ]);

问题是使用带有 richValue 的 appendRow 不要添加 richValue 的属性。

我发现将 RichTextValue 添加到 sheet 的唯一记录方式是通过 setRichTextValue/s

我知道使用 setRichTextValue/s 可以获得相同的结果,但我更喜欢将 appendRow 与 RichTextValue 变量一起使用。

试试 appendRows_() 效用函数,像这样:

const richValue = SpreadsheetApp.newRichTextValue()
  .setText('link')
  .setLinkUrl('www.somesite.com')
  .build();
appendRows_(sheet, [varX, varY, varZ, richValue]);