要获取侧边栏信息,您可以使用Apps Script的Sidebar
类。以下是一个包含代码示例的解决方案:
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Custom Menu')
.addItem('Show Sidebar', 'showSidebar')
.addToUi();
}
function showSidebar() {
var htmlOutput = HtmlService.createHtmlOutputFromFile('sidebar')
.setTitle('Sidebar Title')
.setWidth(300);
SpreadsheetApp.getUi().showSidebar(htmlOutput);
}
sidebar.html
的新文件。sidebar.html
文件中,添加以下代码:
Sidebar Content
This is the content of the sidebar.
这是一个简单的示例,演示了如何使用Apps Script创建并显示一个包含标题和内容的侧边栏。您可以根据自己的需求修改侧边栏的内容和样式。