重新执行电子表格中的所有匹配功能 [英] Re-execute all matching functions in a spreadsheet

查看:87
本文介绍了重新执行电子表格中的所有匹配功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  function sheetName(){return SpreadsheetApp.getActiveSpreadsheet() ).getActiveSheet()。getName();} 

但是,当我更改标签页名称。是否有任何脚本可以写入到重新执行sheetName()函数中,在电子表格中找到的所有位置?我希望只是弹出一个按钮,可以重新运行sheetName(),以便标签名称的引用保持最新。

我确实看到一些旧的(〜4年)关于这个的问题,但努力寻找最新的东西。抱歉,如果这是重复的!

解决方案

您可以安装触发器来运行On change我试着编辑工作表选项卡,

  function sheetNameReturn(e){
Logger.log(e.changeType)
Logger.log('sheetName ran')

返回SpreadsheetApp.getActiveSpreadsheet()。getActiveSheet()。getName();
}

不幸的是,在这篇文章的时候,触发器是一种越野车。如果你安装了一个触发器,并且它不运行,你需要删除触发器,关闭窗口,然后再次通过这个过程并保存。



我将函数的名称改为 sheetNameReturn 让触发器运行有很多麻烦。我必须删除触发器并重新安装。


I have a really simple script to pull the given tab name:

function sheetName() {return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();}

But this will not update when I change a tab's name. Is there any script that could be written to "re-execute" sheetName(), the function, in all places it is found in a spreadsheet? Would love to just pop in a button that could rerun sheetName() everywhere so that the tab names' references stay current.

I do see some old (~4 years) questions about this, but struggling to find something current. Apologies if this is duplicative!

解决方案

You can install a trigger to run "On change" I tried editing a sheet tab, and the code did run.

function sheetNameReturn(e) {
  Logger.log(e.changeType)
  Logger.log('sheetName ran')

  return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
}

Unfortunately, at the time of this post, the triggers are kind of buggy. If you install a trigger, and it doesn't run, you'll need to delete the trigger, close the window, and go through the process again and save it.

I changed the name of the function to sheetNameReturn I had a lot of trouble getting the trigger to run. I had to delete the trigger and install it again.

这篇关于重新执行电子表格中的所有匹配功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆