我正在尝试列出单元格中包含特定值的所有工作表。我用了
function listsheets() {
var out = new Array()
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
for (var i=0 ; i<sheets.length ; i++) out.push( [ sheets[i].getName() ] )
return out
}
如何引入条件以仅列出那些在 B2 单元格中显示“hello”值的工作表?
如果您使用小表格和某些单元格,您可以使用
function listsheets() {
return SpreadsheetApp.getActive().getSheets().reduce(function(p, sheet){
if(sheet.getRange('B2').getValue() === 'hello')
p.push(sheet.getName());
return p;
}, []);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句