运行 来自同一项目中另一个文件的 Google Apps 脚本
Run a Google Apps Script from another file within the same project
我想 运行 我的“通用 Macros.gs”文件中的脚本“xGen_FilterRemove”位于“Macro.gs”中的“测试”脚本中按照下面的内容,但我知道如何正确引用它吗?
function Test() {
var aCurrentBook = SpreadsheetApp.getActive();
'Generic Macros.gs'.xGen_FilterRemove()
}
};
就运行这样
function Test() {
var aCurrentBook = SpreadsheetApp.getActive();
xGen_FilterRemove()
}
项目中的所有函数无论在什么文件中都可以普遍访问。这就是为什么所有函数都必须具有唯一名称的原因。提供这些文件是为了更容易组织它们。您可以在一个文件中包含任意多的函数
我想 运行 我的“通用 Macros.gs”文件中的脚本“xGen_FilterRemove”位于“Macro.gs”中的“测试”脚本中按照下面的内容,但我知道如何正确引用它吗?
function Test() {
var aCurrentBook = SpreadsheetApp.getActive();
'Generic Macros.gs'.xGen_FilterRemove()
}
};
就运行这样
function Test() {
var aCurrentBook = SpreadsheetApp.getActive();
xGen_FilterRemove()
}
项目中的所有函数无论在什么文件中都可以普遍访问。这就是为什么所有函数都必须具有唯一名称的原因。提供这些文件是为了更容易组织它们。您可以在一个文件中包含任意多的函数