Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 如何隐藏和显示谷歌电子表格中的特定名称_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script 如何隐藏和显示谷歌电子表格中的特定名称

Google apps script 如何隐藏和显示谷歌电子表格中的特定名称,google-apps-script,google-sheets,Google Apps Script,Google Sheets,你能帮我做一个自定义脚本,这样我就可以隐藏和显示谷歌电子表格中的特定名称 这是我使用的示例代码: function onOpen() { var menu = [{name: "Hide Daily Columns", functionName: "hideColumns"}, {name: "Show Daily Columns", functionName: "showColumns"}] SpreadsheetApp.getActiveSpreadsheet().addMenu(“

你能帮我做一个自定义脚本,这样我就可以隐藏和显示谷歌电子表格中的特定名称

这是我使用的示例代码:

function onOpen() {
   var menu = [{name: "Hide Daily Columns", functionName: "hideColumns"}, {name: "Show Daily Columns", functionName: "showColumns"}]
SpreadsheetApp.getActiveSpreadsheet().addMenu(“我的视图”,菜单); }

注意:这里的问题是.showColumns有错误提示。无法将范围转换为类


谢谢

showColumns不接受范围。将其更改为unhideColumn,它将接受一个范围。像这样:

function showColumns() {
  sheet.unhideColumn(name)
}

谢谢您的帮助^ ^如果这解决了您的问题,请单击其旁边的复选标记批准答案,好吗?谢谢
function showColumns() {
  sheet.unhideColumn(name)
}