Kloso
Kloso

Reputation: 11

Google apps script, no way to join a Project(with scripts) to a special sheet?

I recognized that when I am creating a new Project in script.google.com, than there is no way to join it to a sheet.

I mean when I am creating a new sheet and open script editor in it, I have a new "Untitled Project". However I would like to have there one of my projects inside.

Like "import" project to a sheet.


I still can not understand the librarys. Google Docs Translator example

In this example we have a script. In this script are functions like

function onInstall(event){
 onOpen(event);
}
function onOpen(event) {
  SlidesApp.getUi().createAddonMenu()
  .addItem('Open Translate', 'showSidebar')
  .addToUi();
}
function showSidebar() {
var ui = HtmlService
  .createHtmlOutputFromFile('sidebar')
  .setTitle('Translate');
  SlidesApp.getUi().showSidebar(ui);
}

But if I going to use librarys, despite I see AddOnMenue which is inside onOpen(), I can not run the function "showSidebar()" because the new sheet only recognized the onOpen() but not the other functions... so I got an error. What is wrong on the schematic?

In my personal script I have about 30 functions. I thought that I can just save the Version, copy the Script Id and use the script within several sheets. But I do not understand the key schematic and why I got an error.

Upvotes: 1

Views: 81

Answers (1)

Cooper
Cooper

Reputation: 64100

Projects are contained in the Spreadsheet not the sheets. Projects can access any sheet or even any spreadsheet via openById(). Yes StandAlone projects are not contained in Spreadsheets. That's why they're called standalone.

Upvotes: 1

Related Questions