Reputation: 13
I am new to programming in Google Apps Script. I wanted to create a script to manage Classroom in Google Sheets. The problem is that everything works fine in the test deployment, but nothing shows up in the normal deployment. I wanted to have a button for the script appear on the right side in the add-ons, which opens an empty CardService for a moment and then a sidebar with an HTML file.
Below is the JSON code:
{
"timeZone": "Europe/Warsaw",
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"dependencies": {
"enabledAdvancedServices": [
{
"userSymbol": "AdminDirectory",
"serviceId": "admin",
"version": "directory_v1"
},
{
"userSymbol": "Classroom",
"serviceId": "classroom",
"version": "v1"
}
]
},
"oauthScopes": [
],
"addOns": {
"common": {
"name": "Zarządzanie Classroomem",
"logoUrl": "://iili.io/dTYC3Dx.png",
"useLocaleFromApp": true,
"homepageTrigger": {
"runFunction": "createCard",
"enabled": true
}
},
"sheets": {
"homepageTrigger": {
"runFunction": "createCard",
"enabled": true
}
}
},
"urlFetchWhitelist": [
"://iili.io/"
]
}
And .gs file:
function createCard() {
let card = CardService.newCardBuilder().build();
let htmlOutput = HtmlService.createHtmlOutputFromFile('Sidebar').setTitle('Zarządzanie Classroomem')
SpreadsheetApp.getUi().showSidebar(htmlOutput);
return card
}
I can't understand why everything works in the test deployment, but not in the normal deployment. I don't know if the problem lies in the link to the image and the whitelist because I filled it out incorrectly. Maybe the error is due to a poorly constructed manifest file, or perhaps it's related to accepting OAuth credentials. I would like to be able to open the sidebar with a button on the right side, not through the menu at the top on the toolbar.
I intentionally removed the https and oauthScopes before the links because the post was detected as spam.
Upvotes: 0
Views: 50
Reputation: 38416
I understand that it can be confusing, but contrary to what might be done with editor add-ons and web apps, the only way to run a Workspace add-on without deploying it to the Google Workspace Marketplace is to install it as a test deployment.
Since you are new to Google Apps Script, I suggest you study the Workspace add-on quickstarts and samples. Once you get your favorite work, you might start a new one from scratch using an iterative approach.
In your first iteration, I suggest you focus on getting a simple home card for your add-on, just with your logo. Keep the manifest with just the required entries for this iteration to make the simple home card work. This way, you should be able to identify if it's causing problems. On the next iteration, add a button that does something simple like writing a message to the execution logs.
If you get stuck, first look at the other quickstarts and samples. If you still need more help, post a new question, but this time, make it focused on a specific problem.
Upvotes: 0