1

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>
Rubén
  • 34,714
  • 9
  • 70
  • 166
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
  • 1
    Consider joining the [Add-ons Community](https://plus.google.com/communities/117193953428311185494) You have not provided enough information for anyone to answer your question. You haven't provided any code. If you don't know how to troubleshoot your code, read the [Troubleshooting Guide](https://developers.google.com/apps-script/guides/support/troubleshooting) – Alan Wells Aug 25 '17 at 20:11
  • I just added some code. – SoftTimur Aug 25 '17 at 20:21
  • what do you mean by task pane? menu item? – Ritesh Nair Aug 25 '17 at 21:15
  • The [task pane](http://www.jegsworks.com/lessons/numbers/intro/taskpane-defaultwindow.gif) is a pane on the right side of a workbook. The UI is coded by the html file. – SoftTimur Aug 25 '17 at 21:27
  • 1
    You are using Google spreadhsheet and it is called [sidebar](https://developers.google.com/apps-script/guides/dialogs#custom_sidebars) – Ritesh Nair Aug 25 '17 at 21:30
  • I see... Then, I should `Publish ==> Test as add-on...` or `Publish ==> Deploy as Sheets web add-on...` (with `Private`) or `Publish ==> Deploy as web app...`? I am very confused... – SoftTimur Aug 25 '17 at 21:35

1 Answers1

1

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.

Ritesh Nair
  • 3,327
  • 1
  • 17
  • 24
  • Thank you... Indeed, `Publish ==> Test as add-on...` works with the sidebar, but not custom functions. So to test sidebar + custom functions, should I `Publish ==> Deploy as Sheets web add-on...` (with `private` or `unlisted`?) or `Publish ==> Deploy as web app...`? – SoftTimur Aug 25 '17 at 21:52
  • 1
    Deploy as Sheets web add-on as private and then check it. The latter (Deploy as web app) is for web based applications – Ritesh Nair Aug 25 '17 at 22:00
  • This is what I did [here](https://stackoverflow.com/questions/45888142/publish-a-custom-function), but I don't know how to load it in a new sheet. Via `Add-ons ==> Get add-ons...` I cannot find the add-on I just published privately. – SoftTimur Aug 25 '17 at 22:06
  • 2
    Did you publish to test account. Check this detailed [document](https://developer.chrome.com/webstore/publish#publishing-to-test-accounts) and [your dashboard](https://chrome.google.com/webstore/developer/dashboard) – Ritesh Nair Aug 25 '17 at 22:17
  • Indeed, I did not `Edit your tester accounts` in the dashboard. I just edited it and added myself, unpublished the add-on and re-published it. But when I opened a google sheet (with my account), I still could not find the add-on. Where is the add-on supposed to appear? – SoftTimur Aug 25 '17 at 22:26
  • I think its better to continue the discussion in the other question thread which you have created, since this question was about Test-Add on only – Ritesh Nair Aug 25 '17 at 22:30