是否有使用Google-Apps-Script在Google表格中选择新单元格的功能?

时间:2019-04-24 13:44:01

标签: google-apps-script

调用函数(makeActive)时,我需要Google工作表来选择特定的单元格(B3)。应该选择该单元格,就像用户自己单击该单元格一样。

1 个答案:

答案 0 :(得分:1)

就像[meta.unary.prop] table 47一样简单:

// The code below sets the cell B5 in the first sheet as the current cell.
var cell = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0].getRange('B5');
SpreadsheetApp.setCurrentCell(cell);

var selection = SpreadsheetApp.getSelection();
// Current cell: B5
var currentCell = selection.getCurrentCell();