11/**
2- * This code creates the UI button under the Extensions menu and runs all scripts or individual scripts based on admin selection.
3- *
2+ * This code creates the UI button under the Extensions menu and runs all
3+ * scripts or individual scripts based on admin selection.
44 */
55
6- // Triggered on install
6+ // Triggered on install
77function onInstall ( e ) {
8- onOpen ( e ) ;
8+ // No need to call onOpen here, it's automatically triggered on opening the sheet
99}
1010
1111// Creates the menu and sub-menu items under "Extensions"
1212function onOpen ( e ) {
1313 SpreadsheetApp . getUi ( )
1414 . createAddonMenu ( )
1515 . addItem ( 'Activate Application' , 'activateApplication' )
16- . addSeparator ( )
16+ . addSeparator ( )
1717 . addItem ( 'Set up or Refresh Sheet' , 'setupSheet' )
1818 . addSeparator ( )
1919 . addItem ( 'Run all scripts' , 'promptRunAllScripts' )
@@ -34,6 +34,7 @@ function onOpen(e) {
3434 . addItem ( 'Get Support' , 'contactPartner' )
3535 . addToUi ( ) ;
3636}
37+
3738// Function to run all scripts with a confirmation prompt
3839function promptRunAllScripts ( ) {
3940 var response = Browser . msgBox (
@@ -78,10 +79,21 @@ function fetchInfo() {
7879}
7980
8081function activateApplication ( ) {
82+ // Perform activation steps here (if any)
83+
8184 const ui = SpreadsheetApp . getUi ( ) ;
82- const result = ui . alert (
85+ ui . alert (
8386 'Activate Application' ,
8487 'Application activated and connected to your Google Account. Next, use the "Set up or Refresh Sheet" button from the extensions menu.' ,
8588 ui . ButtonSet . OK
8689 ) ;
90+ }
91+
92+ function setupSheet ( ) {
93+ const ui = SpreadsheetApp . getUi ( ) ;
94+ ui . alert (
95+ 'Setup Sheet' ,
96+ 'Sheet setup complete!' ,
97+ ui . ButtonSet . OK
98+ ) ;
8799}
0 commit comments