获取调用自定义函数的Spreadsheet单元格 [英] Get Spreadsheet cell calling a custom function

查看:123
本文介绍了获取调用自定义函数的Spreadsheet单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何获得调用自定义函数的单元格的A1表示法.

I am trying to figure out how to get the A1 Notation of a Cell calling a Custom Function.

我发现了这个,但这是针对活动细胞的. https://webapps.stackexchange.com/questions/54414/in-google-script-get-the-spreadsheet-cell-calling-a-custom-function

I found this but this is for active cell. https://webapps.stackexchange.com/questions/54414/in-google-script-get-the-spreadsheet-cell-calling-a-custom-function

基本上,如果我想让单元格A5调用 = TEST().我希望函数返回文本值A5.

Essentially if I want Cell A5 to Call =TEST(). I want the function to return the text value A5.

我想将此用作API调用的缓存标识符.

I want to use this as a cache identifier for an API Call.

推荐答案

不同范围的返回方法名称之间存在细微差异- active current selection:

There are subtle differences in different range returning method names- active,current,selection:

术语有效范围"指的是用户在活动工作表中选择的范围,但是在自定义功能中,它是指正在重新计算的单元格处于活动"状态.

当前单元格是在Google表格用户界面中具有焦点的单元格,并以黑色边框突出显示.

The current cell is the cell that has focus in the Google Sheets UI, and is highlighted by a dark border.

选择是用户的单元格集已在工作表中突出显示,该范围可以不相邻.选择中的一个单元格是当前单元格,即用户当前的焦点所在.

A selection is the set of cells the user has highlighted in the sheet, which can be non-adjacent ranges. One cell in the selection is the current cell, where the user's current focus is.

前两个仍然是范围对象,而后一个不是.

The first two are still range objects,while the latter is not.

我希望函数返回文本值A5.

I want the function to return the text value A5.

没有自定义功能,我们可以使用:

Without Custom Functions,We can use:

=ADDRESS(ROW(),COLUMN())

具有自定义"功能,我们可以使用:

With Custom function,We can use:

function test() { 
 return SpreadsheetApp.getActiveRange().getA1Notation(); 
}

这篇关于获取调用自定义函数的Spreadsheet单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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