Card Based add-on's UI will not appear in the Extensions menu

53 views
Skip to first unread message

Raunak

unread,
Aug 3, 2025, 5:26:38 AM Aug 3
to Google Apps Script Community

Hello, I'm trying to create a Google Sheets add-on that uses a card-based sidebar UI, but I've run into a persistent issue that has stumped me. I've followed all the official documentation and troubleshooting steps I could find, but the add-on's UI will not appear in the Extensions menu. I'd appreciate any insight from the community.


Problem Description

My add-on's onSheetsHomepage(e) function executes successfully, as confirmed by a "Completed" status in the Apps Script Executions log. However, the add-on never appears in the Google Sheets Extensions menu, so I can't launch the sidebar or see the add-on. Curiously, a simple onOpen() function I previously used worked perfectly, which suggests the issue is specific to the onSheetsHomepage trigger or the CardService UI rendering.


App & Code Details

The app is a simple password generator. The code is structured as a standard Google Workspace Add-on.

Apps Script Code ( .gs file):

JavaScript
/**
* The trigger function that builds the initial UI for the add-on sidebar.
* This is defined in the appsscript.json manifest file.
*
*/

function onSheetsHomepage ( e ) {
// Create a card builder
var cardBuilder = CardService . newCardBuilder ();

// Create a header for the sidebar
var header = CardService . newCardHeader ()
. setTitle ( "Smart Password Generator" )
. setSubtitle ( "Generate a strong password" );
cardBuilder . setHeader ( header );

// Create a section with a button to trigger the password generation
var section = CardService . newCardSection ()
. addWidget ( CardService . newTextParagraph (). setText ( "Click the button below to generate a password based on your criteria." ));
// Create an action button. When clicked, it will call the generatePassword function.
var generateButton = CardService . newTextButton ()
. setText ( "Generate Password" )
. setOnClickAction ( CardService . newAction (). setFunctionName ( 'generatePassword' ));
section . addWidget ( generateButton );
// Build and return the card
cardBuilder . addSection ( section );
return cardBuilder . build ();
}

/**
* Generates a password and writes it to cell B9 of the active sheet.
* This function is now triggered by the sidebar button.
*/
function generatePassword () {
var sheet = SpreadsheetApp . getActiveSpreadsheet (). getActiveSheet ();

// Get user specifications
var length = parseInt ( sheet . getRange ( 'B3' ). getValue ());
var includeUppercase = sheet . getRange ( 'B4' ). getValue (). toLowerCase () === 'yes' ;
var includeLowercase = sheet . getRange ( 'B5' ). getValue (). toLowerCase () === 'yes' ;
var includeNumbers = sheet . getRange ( 'B6' ). getValue (). toLowerCase () === 'yes' ;
var includeSymbols = sheet . getRange ( 'B7' ). getValue (). toLowerCase () === 'yes' ;

var characterSet = '' ;
if ( includeUppercase ) characterSet += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ;
if ( includeLowercase ) characterSet += 'abcdefghijklmnopqrstuvwxyz' ;
if ( includeNumbers ) characterSet += '0123456789' ;
if ( includeSymbols ) characterSet += '!@#$%^&*()_+[]{}|;:,.<>?' ; // You can customize symbols here

if ( characterSet === '' ) {
SpreadsheetApp . getUi (). alert ( 'Please select at least one character type.' );
return ;
}

var password = '' ;
for ( var i = 0 ; i < length ; i ++) {
var randomIndex = Math . floor ( Math . random () * characterSet . length );
password += characterSet . charAt ( randomIndex );
}

// Output the generated password
sheet . getRange ( 'B9' ). setValue ( password );
}

// The onOpen function is not needed for the sidebar-based add-on,
// so it is commented out. The add-on framework handles the UI.
// function onOpen() {
// var ui = SpreadsheetApp.getUi();
// ui.createMenu('Password Generator')
// .addItem('Generate Password', 'generatePassword')
// .addToUi();
// }

appsscript.json Manifest File:

JSON
{
"timeZone" : "America/Los_Angeles" ,
"dependencies" : {},
"exceptionLogging" : "STACKDRIVER" ,
"runtimeVersion" : "V8" ,
"addOns" : {
"common" : {
"name" : "Smart Password Generator" ,
"homepageTrigger" : {
"runFunction" : "onSheetsHomepage"
}
},
"sheets" : {
"homepageTrigger" : {
"runFunction" : "onSheetsHomepage"
}
}
},
"oauthScopes" : [
]
}

Steps I Have Already Followed

I've been through a comprehensive troubleshooting process, which includes:

  1. Correct Manifest Configuration: I've confirmed that the appsscript.json file is correctly formatted, with "homepageTrigger" pointing to "onSheetsHomepage" and "oauthScopes" including both spreadsheets and script.container.ui.

  2. Add-on Deployment: The script is deployed as an "Add-on" type (not a "Web App") from the Apps Script editor.

  3. Test Installation: I've used the "Test deployment" feature from the "Manage deployments" panel, and the installation completed successfully.

  4. Authorization: I've gone through the OAuth consent screen and clicked "Allow" for all requested scopes. I've also tried removing access from my Google account and re-installing to force a fresh authorization.

  5. Execution Log Check: The Executions log shows a "Completed" status for onSheetsHomepage every time I attempt to launch the add-on from Extensions > Add-ons > [My Add-on Name] > Open, indicating the function is successfully running without crashing.

  6. Browser & Account Check: I've cleared my browser cache and cookies, used an Incognito window, and confirmed that I am signed into the exact same Google account in both the Apps Script editor and Google Sheets.

  7. GCP Project Configuration: I've confirmed that the Google Sheets API and Google Workspace Marketplace SDK are enabled in the linked GCP project, and the OAuth consent screen is configured for "External" users and is in "Testing" mode with the correct scopes added.

My Specific Question:

Given that onSheetsHomepage executes successfully but the UI doesn't appear, and the add-on itself is not listed in the Extensions menu (even after Test Deployment), what could possibly be causing this behavior? Are there any subtle issues with CardService UI rendering or a specific manifest field that could lead to this? How can I definitively confirm that the https://www.googleapis.com/auth/script.container.ui scope is properly registered and authorized for this deployment, as it seems to be the last possible point of failure?


Hilario Rivera

unread,
Aug 4, 2025, 9:36:58 AM Aug 4
to google-apps-sc...@googlegroups.com
Ya le hicistes la consulta a IA? yo he resuelto varios temas por medio IA. Saludos.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com .
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/09e70a5a-c4ed-43c9-8657-90f9a1dd56fcn%40googlegroups.com .

Raunak

unread,
Aug 5, 2025, 5:32:06 AM Aug 5
to google-apps-sc...@googlegroups.com
Yes I did ask Gemini. It even rewrote the code for me but it isn't working. 

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/vo_IERemDos/unsubscribe .
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com .
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/CANnM%3DNxPSCFnHk8AGx1YT4anhJsZ_cpmjfizXQxVD%2BqMTC8Kkw%40mail.gmail.com .

Brett Grear

unread,
Aug 5, 2025, 9:09:42 AM Aug 5
to Google Apps Script Community
Card based extensions don't appear in the extension menu. They appear on the right tool bar. You'll need to create a test deployment first.
Reply all
Reply to author
Forward
0 new messages