我找到了this old thread,但似乎无法使用任何方法。
问题:我有一个电子表格,有数十个人使用,并且随着时间的推移,已经创建了200多个过滤器视图。我想从工作簿的一张工作表中批量删除所有过滤器视图。
启用Google Sheets API后,我尝试了此方法。它可以运行,但是,所有过滤器视图仍然保留。
mergeObject() {
let merged = {};
this.needMergedArray.map(item => {
merged = {...merged, [item.key]: {key: [item.key], server: (merged[item.key] && merged[item.key].server || []).concat(item.server)}};
});
return Object.values(merged);
}
}
谢谢所有
答案 0 :(得分:0)
deleteFilterView
请求function delFilterViews() {
var ssId = SpreadsheetApp.getActive().getId();
Sheets.Spreadsheets.batchUpdate(
{
requests: Sheets.Spreadsheets.get(ssId, {
ranges: 'Sheet1', //Sheet in which filterviews are present
fields: 'sheets/filterViews/filterViewId',
}).sheets[0].filterViews.map(function(e) {
return { deleteFilterView: { filterId: e['filterViewId'] } }; //create a new delete filter view request for each filter view present in sheet1
}),
},
ssId
);
}