Test a Google Sheet add-on

1.3k views Asked by At

I have created an add-on in Script Editor with Code.gs and Index.html. I choose Publish ==> Test as add-on... and then selected another google sheet in the dialog box. Clicking on Test opens that google sheet, but I don't see any taskpane that should be made by index.html, =myFunction() does not work either in cells.

Does anyone know how to test this add-on?

Edit 1: Code.gs:

function myFunction() {
  return 100
}

Index.html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    super add-on
  </body>
</html>
1

There are 1 answers

6
Ritesh Nair On BEST ANSWER

You can definitely test the sidebar add-on, in other sheet. You need to use the below script. Also, make sure you select INSTALLATION CONFIG as Installed & Enabled.

function onOpen() {
   var html = HtmlService.createHtmlOutputFromFile('index') //your html page name
      .setTitle('My custom sidebar')
      .setWidth(300);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}

Currently, custom functions are not working in test add-on mode. There is already an issue reported for this and Google as accepted it. Check this.