function onOpen(e) {
var menu = SpreadsheetApp.getUi().createAddonMenu();
if (e && e.authMode == ScriptApp.AuthMode.NONE) {
// Add a normal menu item (works in all authorization modes).
menu.addItem('Start workflow', 'startWorkflow');
} else {
// Add a menu item based on properties (doesn't work in AuthMode.NONE).
var properties = PropertiesService.getDocumentProperties();
var workflowStarted = properties.getProperty('workflowStarted');
if (workflowStarted) {
menu.addItem('Check workflow status', 'checkWorkflow');
} else {
menu.addItem('Start workflow', 'startWorkflow');
}
// Record analytics.
UrlFetchApp.fetch('http://www.example.com/analytics?event=open');
}
menu.addToUi();
}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-08-29。"],[[["AuthMode defines the level of access Apps Script has to authorized services when a triggered function is executed."],["It's crucial for understanding how add-ons and scripts interact with Google services, especially concerning user authorization."],["Different AuthModes like NONE, LIMITED, and FULL, dictate the scope of service access, impacting functionalities within triggered functions."],["Custom functions operate under a specific authorization mode that allows restricted access to certain services without explicit user authorization."]]],[]]