首页 > 解决方案 > Google 表格脚本 getCurrentCell()

问题描述

我是 Google Scripts 的新手,需要帮助找到以下代码的解决方案:

var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

// Returns the current highlighted cell in the one of the active ranges.

var currentCell = sheet.getCurrentCell();

当我保存它时,它不允许我运行脚本。有什么我想念的吗?

标签: google-apps-script

解决方案


用这个 -

function getCurrentCellValue() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var currentCell = sheet.getCurrentCell();
  // do what you need to do
}

推荐阅读