Google apps script 谷歌应用程序脚本。如何从左侧和导航器ov获取单元格

Google apps script 谷歌应用程序脚本。如何从左侧和导航器ov获取单元格,google-apps-script,google-sheets,Google Apps Script,Google Sheets,我是新来的。查看文档,谷歌搜索,但找不到我想要的东西 使用谷歌应用程序脚本 我想得到一个靠近当前单元格左侧的单元格对象 var sheet = SpreadsheetApp.getActive(); var cell = sheet.getCurrentCell() // var priceColumn = cell.getColumn()-1; // var strategyColumn = cell.getColumn()-2; 手机,左边 基

我是新来的。查看文档,谷歌搜索,但找不到我想要的东西

使用谷歌应用程序脚本

我想得到一个靠近当前单元格左侧的单元格对象

      var sheet = SpreadsheetApp.getActive();
    
       var cell = sheet.getCurrentCell()

 // var priceColumn = cell.getColumn()-1;

  // var strategyColumn = cell.getColumn()-2;
手机,左边

基本上,我需要导航左、右、上、下当前单元格。

您正在寻找函数:

示例:

var sheet = SpreadsheetApp.getActive();
var cell = sheet.getCurrentCell();

var newCell = cell.offset(0, 1); // cell to the right
var newCell = cell.offset(0, -1); // cell to the left
var newCell = cell.offset(1, 0); // cell below
var newCell = cell.offset(-1, 0); // cell above 
偏移量(行偏移量、列偏移量)

您正在寻找以下功能:

示例:

var sheet = SpreadsheetApp.getActive();
var cell = sheet.getCurrentCell();

var newCell = cell.offset(0, 1); // cell to the right
var newCell = cell.offset(0, -1); // cell to the left
var newCell = cell.offset(1, 0); // cell below
var newCell = cell.offset(-1, 0); // cell above 
偏移量(行偏移量、列偏移量)