我有一个工作表,其中包含要在另一个页面(按名称、输赢/失败、日期等)过滤的匹配列表。但是它们每个都有多行,我如何指定每个选择的格式?谢谢!

编辑:这应该是期望的结果示例:匹配过滤选项的多行列表(我尝试使用filter(),但只获取单个行,例如:如果我按补丁过滤,则在蓝色/红色草稿上只给出一个名称,而不是所有5行)下面是一个示例:https://docs.google.com/spreadsheets/d/1NlAG6kt6RsqzOJ3HgYwmyaKqF01gM364cv8AcjDtt9o/edit?usp=sharing
我在找什么(不相关的过滤器):

我得到的是:

发布于 2021-02-25 22:39:43
以下解决方案是Apps Script上的一个简单示例,说明如何使用simple trigger onEdit()、getting和setting值来实现这一点。我只是在Patch下拉菜单上实现了这一点,但这也说明了其他项目是如何实现的。
下面这段代码有不言自明的注释:
function onEdit(e) {
// Get both sheets
var sheet = SpreadsheetApp.getActive().getSheetByName('Stats');
var matchSheet = SpreadsheetApp.getActive().getSheetByName('Match History');
// check if the cell modified is the right cell on the right sheet
if(e.range.getColumn()==3 && e.range.getRow()==6 && e.source.getActiveSheet().getSheetName()==='Stats'){
// Get all the values available for patch
var patches = matchSheet.getRange(3,2,matchSheet.getLastRow(),1).getValues().flat();
// iterate over all the patches values
for(i=0;i<patches.length;i++){
// if there is a match with the selected value from the dropdown
if(patches[i]===e.range.getValue()){
// get the range of the next 5 rows and the next 10 columns from the original sheet
// each patch is a merge of 5 rows, thus taking the next 5 rows as the range
var pasteValues = matchSheet.getRange(i+ 3,2,5,10).getValues();
// append these values in the row after the last written cell in the right place of stats
sheet.getRange(sheet.getLastRow()+1,2,5,10).setValues(pasteValues)
}
}
}
}
https://stackoverflow.com/questions/66258535
复制相似问题