Google App Script - 列出所有包含

大卫马丁

我正在尝试列出单元格中包含特定值的所有工作表。我用了

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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

带有主体的 GET 请求,Google Script App

Google App Script 权限,过多?

Google-app-script SyntaxError

Google App Script 捕获行号

列出Google App Engine数据存储区中的所有实体时出现AttributeError

有没有办法从 Google App Script 分配触发器所有权?

将状态添加到 for 循环中的每个已处理行,其中包含带有 Google App Script 的 if 语句

Google App Script:如何显示带有模板化 HTML 链接的 Google Drive 文件

更改所有标签颜色 Google Script

类型错误:在对象中找不到包含函数(Google App Script)

Google Sheets App Script If Else 不工作

Google App Script HTML表格样式

Google Script Web App HTML记录问题

Google App Script URLFetchApp.fetch 超时

Google Apps Script Multiple Search with Drive App

Google App Script 循环遍历值数组

在多个Google表格之间共享App Script Web App

Google App Script / Gmail 插件:如何在 Gmail 上显示带有文本和按钮的窗口?

在App Script中将.XLS转换为Google表格的最有效方法是什么?

Google App Script 将单个元素分解为具有多个元素的一维数组

Google App Script:提交时获取 Google 表单响应的内容

Google App Script 将 CSV 导入到 Google 表格

Google Web App google.script.run 不工作

Google App Script:从 A 列中获取所有 URL,然后在母版表中分别获取 openByURL、getSheetByName、getRange、getValues 和 setValues

如何在 Google Script 中传递所有数组

Google Sheets Script getLastRow() 不返回所有值

Google App Script 无法使用 .toUppercase() 将变量大写

Google App Script 中的全局变量问题

Google App Script - 函数返回未定义