简体   繁体   English

Google Apps脚本 - getRowIndex无效

[英]Google Apps Script - getRowIndex not functioning

I had two similar applications that stopped functioning correctly. 我有两个类似的应用程序停止正常运行。 Both use the method, 'getRowIndex' and will no longer populate a variable for the position of my cursor with the active row positions. 两者都使用'getRowIndex'方法,并且不再使用活动行位置填充光标位置的变量。 Has anyone experienced this? 有没有人经历过这个? It looks like Google changed the way the getRowIndex function works within Google Apps Script. 看起来谷歌改变了getRowIndex功能在Google Apps脚本中的工作方式。 Any help with this is greatly appreciated. 非常感谢任何帮助。 Below is a copy of my code where the problem is occurring. 下面是我的代码的副本,其中发生了问题。

var sheet1 = SpreadsheetApp.getActiveSheet();
var row1 = sheet1.getActiveRange().getRowIndex();

In the above example row1 always takes the value of 1 as if the cursor is on the first row which is not the case. 在上面的示例中,row1始终采用值1,就好像光标位于第一行而不是这种情况。

Thank you in advace for you time to help with this. 谢谢你有时间帮忙解决这个问题。 Jeff 杰夫

There has been an issue with this some time ago but it is fixed... You can try this test sheet and see if it works with you (see 2 test functions in menu). 这段时间以前出现了一个问题,但它已经修复了......你可以试试这个测试表 ,看看它是否适合你(参见菜单中的2个测试功能)。 If not (which is unlikely to happen) you can raise an issue in the issue tracker . 如果不是(这不太可能发生),您可以在问题跟踪器中提出问题

Just tried running your snippet only adding the line Browser.msgBox(row1); 刚尝试运行你的代码片段只添加了Browser.msgBox(row1); and wrapping in a function which is running behind the button in this spreadsheet and getRowIndex() is working. 并包装在此电子表格中按钮后面运行的函数中,并且getRowIndex()正在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM