合并来自不同工作表的特定行值

时间:2017-01-26 08:14:40

标签: google-apps-script google-sheets

我正在寻找一种在满足某些验证时合并多个电子表格中特定行值的方法。

场景:我目前有Sheet1,Sheet2,Sheet3 我想要的是在满足验证时将sheet2和sheet3中的数据合并到sheet1中。

Sheet 1中:

enter image description here

Sheet 2中:

enter image description here

表Sheet 3:

enter image description here

基于上面的例子,我在sheet1单元格A2中使用了这个函数

=iferror(query(Sheet2!A2:E, "where E = 'New Player' ",0),"")

所以如果列E“类型”是“新玩家”(验证),它会自动添加Sheet2中的行值。

我想要的是如果它的类型是“新玩家”,我还想添加sheet3行数据。

也许有一种嵌套查询功能的方法?或者可以使用脚本完成吗?我发现一些脚本能够复制行但没有验证而不是多张表。

1 个答案:

答案 0 :(得分:2)

假设您在同一个电子表格中查询,这样的事情应该起作用

=iferror(query({Sheet2!A2:E; Sheet3!A2:E}, "Select Col1, Col2, Col3 where Col5 = 'New Player' ",0),"")

编辑:如果你想选择要返回的列(例如A,B,C而不是其他列)

Problem :The version of glassfish 
     glassfish 4.1.1 has problem with the jdbc you can't create the jdbc in the control panel of glassfish 4.1.1

Solution : Use the glassfish 4.0.0