本文介绍了突然moveActiveSheet返回错误-Google Apps脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误:

当我尝试在Google表格上执行脚本时.该脚本直到今天还可以正常工作.

when I try to execute a script on a Google sheet.The script worked fine until today.

我认为问题发生在这两行之间:

I believe the problem occurs between these two lines:

  var newTab = sheet.duplicateActiveSheet();
  sheet.moveActiveSheet(1);

因为出现错误,所以已经创建了重复的工作表但尚未移至第一位置.

because at the time of the error the duplicate sheet has been createdbut has not yet been moved to the first position.

"moveActiveSheet" 命令是否可能突然无法找到刚刚创建的新活动工作表?

Is it possible that the "moveActiveSheet" command suddenly can notfind the new active sheet that has just been created?

如果是这样,还有其他方法吗?

If so, is there some other way to do this?

推荐答案

问题是moveActiveSheet行中的内部错误.

The problem is an internal error in the moveActiveSheet line.

我找到了解决该问题的方法.在脚本中,注释掉moveActiveSheet行,如下所示:

I have found a work around for the problem.In the script comment out the moveActiveSheet line as shown here:

  var newTab = sheet.duplicateActiveSheet();
  // sheet.moveActiveSheet(1);
  sheet.renameActiveSheet(newTabName);

这将导致新选项卡放错位置.您可以手动将其移动到第一个位置.

This will result in the new tab being misplaced.You can manually move it to the first position.

Google声称正在针对此问题进行修复.请参见 https://issuetracker.google.com/issues/175625775

Google claims to be working on a fix for this problem.See https://issuetracker.google.com/issues/175625775

这篇关于突然moveActiveSheet返回错误-Google Apps脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:59