gss*_*ssi 1 google-sheets google-apps-script
无论实际选择的角单元格如何,以下代码始终返回对左上角单元格的引用。
var actvC = SpreadsheetApp.getActiveRange();
var txt_actvC = actvC.getA1Notation();
actvC = SpreadsheetApp.getActiveSheet().getActiveCell();
txt_actvC = actvC.getA1Notation();
Run Code Online (Sandbox Code Playgroud)
是否有办法识别实际选定的单元格?
小智 6
有一个getCurrentCell()now 返回当前选定的单元格。
返回活动工作表中的当前单元格;如果没有当前单元格,则返回 null。当前单元格是 Google 表格 UI 中具有焦点的单元格,并以深色边框突出显示。当前单元格永远不会超过一个。当用户选择一个或多个单元格范围时,所选内容中的单元格之一就是当前单元格。
例子:
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Returns the current highlighted cell in the one of the active ranges.
var currentCell = sheet.getCurrentCell();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8531 次 |
| 最近记录: |