How can I invoke my standalone script in my spreadsheet?

后端 未结 3 558
野的像风
野的像风 2020-12-30 11:30

I have created a standalone Apps Script from Google Drive, but when I try to access it from a Google Spreadsheet, I don\'t see a way to access the script (even though when I

3条回答
  •  抹茶落季
    2020-12-30 11:54

    I worked this out with Jordan, following the instructions here:

    https://developers.google.com/apps-script/guide_libraries

    • First, he had to share his standalone script with me, so I had read access to it (probably setting the script as public read would work too).
    • Then he told me his project key.
    • I took his project key and inserted it in "Find a Library", in the "Manage Libraries" menu.
    • For this to work, Jordan had to export "a version" of his library - so third parties can rely on stable code and upgrade at their own rhythm.
    • As Jordan's script runs automatically on onOpen(), my code had to define a function onOpen() that called his script onOpen(). To do this, the library manager gave me an identifier for the imported library.

    Sample code once the library is imported and the library manager gives you an identifier for the library:

       function onOpen() {
         GivenLibraryIdentifier.onOpen();
       }
    

提交回复
热议问题