我使用下面的脚本按下面的columnIndex 8进行过滤。有人可以帮我弄清楚如何同时按两列进行过滤吗?
function setFilter() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var filterSettings = {};
var condition_value = {
"type": "TEXT_EQ",
"values": [{"userEnteredValue": "D"}]
};
filterSettings.range = {
sheetId: ss.getActiveSheet().getSheetId()
};
filterSettings.criteria = {};
var columnIndex = 8;
filterSettings['criteria'][columnIndex] = {
'condition' : condition_value
};
var request = {
"setBasicFilter": {
"filter": filterSettings
}
};
Sheets.Spreadsheets.batchUpdate({'requests': [request]}, ss.getId());
}
答案 0 :(得分:0)
例如,当将过滤器应用于“ columnIndex”的7和8时,如何进行如下修改?
filterSettings.criteria = {};
var columnIndex = 8;
filterSettings['criteria'][columnIndex] = {
'condition' : condition_value
};
filterSettings.criteria = {};
var columnIndex1 = 7;
var columnIndex2 = 8;
filterSettings['criteria'][columnIndex1] = {
'condition' : condition_value
};
filterSettings['criteria'][columnIndex2] = {
'condition' : condition_value
};
如果我误解了您的问题,请告诉我。我想修改它。