首页 > 解决方案 > 在脚本中使用 importhtml 函数时出错

问题描述

我正在尝试importhtml()在脚本中使用 google sheet 函数来传递编码的查询参数。

function recode(query) {
const value = encodeURIComponent(query).replace('%20','+');
 var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A3').activate();
  spreadsheet.getCurrentCell().setFormula('=importhtml("xxx.com/?query='+value+'","table",1)');

}

我收到一个错误“例外:您无权调用 setFormula(第 5 行)。”

标签: google-apps-scriptgoogle-sheets-formula

解决方案


推荐阅读