没有使用setFormula Google appScript的权限 [英] Do not have permission to use setFormula Google appScript

查看:80
本文介绍了没有使用setFormula Google appScript的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个具有单元格地址的脚本.

I am trying to make a script where I have the address of the cell.

在excel中,我有以下代码:

In excel, I have this code:

Function pos(cell As Range)
    pos = cell.Address
End Function

它给了我单元格的地址.

And it gives me the address of the cell.

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

On Google app script I tried this code:

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;
}

但是会收到一条错误消息,提示您无权调用setFormula".

But get an error saying "You do not have permission to call setFormula".

是否有获得此许可的方法或解决方法?

Is there a way to have this permission or a way around?

推荐答案

自定义函数不能用于设置单元格公式,它们只能用于返回值/值数组.参考号 Google表格中的自定义功能

Custom functions can't be used to set cell formulas, they can only be used to return a value/array of values. Ref. Custom Functions in Google Sheets

要自动设置单元格的公式而不是使用自定义函数,可以使用从以下位置调用的函数:

To automatically set the formula of a cell instead of using a custom function you might use a function called from:

  • 自定义菜单
  • 按钮
  • 对话框或侧边栏
  • 简单或可安装的触发器

资源

相关

这篇关于没有使用setFormula Google appScript的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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