Google Apps 脚本 setFormula 函数

用户13332855

我在使用以下代码在 5 个特定单元格中插入 ArrayFormulas 时遇到了 Googles Apps 脚本的一些问题:

function AddForm() {
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  const sh=ss.getSheetByName('sheetname');
  var cell = sheet.getRange("Z2");
  cell.setFormula('=iferror(arrayformula(vlookup(J2:J,othersheetname!$L:$M,2,false)),"")');
  var cell = sheet.getRange("AA2");
  cell.setFormula('=iferror(arrayformula(vlookup(K2:K,othersheetname!$P:$Q,2,false)),"")');
  var cell = sheet.getRange("AB2");
  cell.setFormula('=iferror(arrayformula(vlookup(K2:K,othersheetname!$P:$Q,2,false)),"")');
} 

我收到“ReferenceError: Run_AddForm 未定义”错误消息,不明白为什么。

请问有人可以帮忙吗?

预先感谢您的支持

这是仍然存在问题的调用函数:

function ManualSGAConso() {
 Run_MID2019();
 Run_2019SC();
 Run_MID2020();
 Run_AddForm();
}
马里奥

首先,你在 AddForm() 函数中犯了一个小错误:

sh应该是

  function AddForm() {
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  const sheet=ss.getSheetByName('sheetname');
  var cell = sheet.getRange("Z2");
  cell.setFormula('=iferror(arrayformula(vlookup(J2:J,othersheetname!$L:$M,2,false)),"")');
  var cell = sheet.getRange("AA2");
  cell.setFormula('=iferror(arrayformula(vlookup(K2:K,othersheetname!$P:$Q,2,false)),"")');
  var cell = sheet.getRange("AB2");
  cell.setFormula('=iferror(arrayformula(vlookup(K2:K,othersheetname!$P:$Q,2,false)),"")');
} 

由于您收到的错误消息正在寻找 Run_AddForm() 函数,请尝试将Run_AddForm()替换AddForm()

function ManualSGAConso() {
 Run_MID2019();
 Run_2019SC();
 Run_MID2020();
 AddForm();
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Google Apps脚本要求

函数运行时的Google Apps脚本刷新表

Google Apps脚本-MailApp

从Google Sheets API v4调用Google Spreadsheets Apps脚本函数

Google Apps脚本:InsertImage()函数不起作用

indexOf依赖于父函数的变量(数组)在Map函数中运行(Google Apps脚本)

使用file.makeCopy()函数复制的副本(Google Apps脚本)

使用Google表格中的脚本设置setFormula

错误:setBackgroundColorTransparent()不是Google Apps脚本中的函数

函数将未定义的函数传递给Google Apps脚本中的被调用函数

Google Apps脚本:onEdit

调用Google Apps脚本

如何在Google Apps脚本中导入函数

Google Apps脚本错误值

找不到Google Apps脚本库嵌套函数

由特定表单提交触发的Google Apps脚本OnSubmit函数

Google Apps Script - 将应用程序脚本函数的输出返回到 html 文件 javascript 函数

Google Apps 脚本:“找不到脚本函数”错误

连续运行 Apps 脚本函数

Google Apps 脚本 HTML 表单

Google Apps 脚本 indexOf

在 Google Apps 脚本中运行多个函数

Google Apps 脚本:使用各种脚本时未定义的 var 或函数(依赖项)

不是 Google Apps 脚本中的函数错误

工作表单元格中的 Google Apps 脚本 setFormula() 遇到“#REF!” 使用函数 doGet(e) 发出问题

.findIndex() - 字符串不是函数。Google Apps 脚本

哪个函数比 FOR 更快?Google Apps 脚本 - Google 表格

错误 .getValues () 不是 Google Apps 脚本的函数

TypeError:范围不是 Google Apps 脚本中的函数