getActiveCell总是返回A1 [英] getActiveCell always returns A1

查看:170
本文介绍了getActiveCell总是返回A1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用新的Google Sheets API,并且每次尝试获取活动单元格时,都会返回第一个表格中的单元格A1,无论如何。这里是我的代码:

  var s = SpreadsheetApp.getActiveSpreadsheet(); 
var ss = s.getActiveSheet();
var result = ss.getActiveCell()。getValue();

看起来像一个Google bug ...

解决方案

目前这对我来说非常合适。如果我突出显示活动工作表中的一个单元格并运行您的代码,则会为我记录单元格中的值。

I'm using the new Google Sheets API and any every time I try to get the active cell, it just returns cell A1 in the first sheet, no matter what. Here's my code:

var s = SpreadsheetApp.getActiveSpreadsheet();
var ss = s.getActiveSheet();
var result = ss.getActiveCell().getValue();

Seems like a Google bug...

解决方案

This is currently working perfectly for me. If I highlight a cell in the active sheet and run your code, the value in the cell is logged for me.

这篇关于getActiveCell总是返回A1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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