小编Ale*_*dre的帖子

没有权限使用 setFormula Google appScript

我正在尝试制作一个脚本,其中包含单元格的地址。

在Excel中,我有这样的代码:

Function pos(cell As Range)
    pos = cell.Address
End Function
Run Code Online (Sandbox Code Playgroud)

它给了我单元格的地址。

在 Google 应用程序脚本上,我尝试了以下代码:

function addrss(cel){
    var spreadsheet = SpreadsheetApp.getActive();
    var cc = spreadsheet.getCurrentCell().activate();
    c = cc.setFormula('=ADDRESS(COLUMN('+cel+');ROW('+cel+'))');
    return c;
}

function pos(cell){
    var ad = addrss(cell);
    return ad;
}
Run Code Online (Sandbox Code Playgroud)

但收到错误消息“您无权调用 setFormula”。

有没有办法获得此许可或解决方法?

google-sheets google-apps-script custom-function google-sheets-formula

6
推荐指数
1
解决办法
4790
查看次数