Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 使用编程查找在google工作表中合并多个范围_Google Apps Script_Google Sheets_Google Sheets Formula_Array Formulas_Google Sheets Query - Fatal编程技术网

Google apps script 使用编程查找在google工作表中合并多个范围

Google apps script 使用编程查找在google工作表中合并多个范围,google-apps-script,google-sheets,google-sheets-formula,array-formulas,google-sheets-query,Google Apps Script,Google Sheets,Google Sheets Formula,Array Formulas,Google Sheets Query,我有一个谷歌工作表,里面有动态变化的工作表数量。我希望能够自动合并包含在具有工作表名称的命名区域中的所有工作表 我有一个手动公式正在运行,将所有数据合并到一个工作表中。我想从指定的范围计算这个 UNION FORMULA ={QUERY('Sheet1'!A2:L, "select * where A != ''");QUERY('Sheet2'!A2:L, "select * where A != ''")} 我在另一个工作表中也有一个命名范围,其中包含所有工作表名称 NAMED RANG

我有一个谷歌工作表,里面有动态变化的工作表数量。我希望能够自动合并包含在具有工作表名称的命名区域中的所有工作表

我有一个手动公式正在运行,将所有数据合并到一个工作表中。我想从指定的范围计算这个

UNION FORMULA

={QUERY('Sheet1'!A2:L, "select * where A != ''");QUERY('Sheet2'!A2:L, "select * where A != ''")}
我在另一个工作表中也有一个命名范围,其中包含所有工作表名称

NAMED RANGE

WORKSHEET_NAMES = {Sheet1,Sheet2,Sheet3)
我以前也曾使用它从工作表中提取数据,使用

Col A - this duplicates the range of worksheet names in column A
=QUERY(WORKSHEET_NAMES, "select A where A != ''")

Col B-Z - this looks up the worksheet name and pulls in the range from a string
=QUERY(indirect($A2&"!$A$2:$N"), "select * order by B desc limit 1")
我不知道是否有可能我已经搜索了1个多小时来将我的工作表名称查找与我的联合操作相结合,或者我是否需要借助于在谷歌脚本中编写一些东西来实现联合

编辑

联合工作表显示所需的输出,但它是一个手动公式,不是从命名的范围工作表名称生成的


最新的工作表显示了命名范围工作表的名称,该工作表使用间接方式从字符串中选取范围。

如果不使用脚本,您可以在C1中构建公式生成器,如:

然后在需要的地方复制粘贴C2

要跳过重新复制粘贴,可以使用脚本:

function onEdit() { 
var sheet = SpreadsheetApp.getActive().getSheetByName("Contants");  
var src = sheet.getRange("C2");   // The cell which holds the formula
var str = src.getValue();
var cell = sheet.getRange("C10");  // The cell where I want the results to be
cell.setFormula(str);
}
因此,它将复制C2中生成的formula字符串,并将其作为true formula粘贴到C10中,所以您只需在列中键入工作表名称,所有内容都将自动更新


没有脚本,您可以在C1中构建公式生成器,如:

然后在需要的地方复制粘贴C2

要跳过重新复制粘贴,可以使用脚本:

function onEdit() { 
var sheet = SpreadsheetApp.getActive().getSheetByName("Contants");  
var src = sheet.getRange("C2");   // The cell which holds the formula
var str = src.getValue();
var cell = sheet.getRange("C10");  // The cell where I want the results to be
cell.setFormula(str);
}
因此,它将复制C2中生成的formula字符串,并将其作为true formula粘贴到C10中,所以您只需在列中键入工作表名称,所有内容都将自动更新


没有谷歌应用程序脚本的解决方案

要求:

3个个体辅助细胞 1“帮助器”列,每次单击时都需要手动向下拖动 添加新的图纸名称,或者只需将其向下拖动1000次即可 这将有助于下一个1000页。。。 以报废单为例,a列中有一个列表


在单元格B1中,put=arrayformulaiflen'&A1&'!A2:C没有Google应用程序脚本的解决方案

要求:

3个个体辅助细胞 1“帮助器”列,每次单击时都需要手动向下拖动 添加新的图纸名称,或者只需将其向下拖动1000次即可 这将有助于下一个1000页。。。 以报废单为例,a列中有一个列表


在单元格B1中,put=arrayformulaiflen'&A1&'!A2:CPerhaps你可以发布一个带有样本数据和所需输出的测试表链接,这样我们就可以确保我们确切地知道我们想要什么输出。我会做的,我会尽力去做tonight@CodeCamper这就是我添加的示例Sheet我提供了一个没有Google应用程序脚本的混乱解决方案,请让我知道它是否适用于您。也许您可以发布一个带有样本数据和所需输出的测试表链接,这样我们就可以确保我们确切地知道我们想要的输出。我会做的,我会尝试去做tonight@CodeCamper这就是我添加的示例Sheet我提供了一个没有Google应用程序脚本的混乱解决方案,请让我知道它是否适合你。