How can I invoke my standalone script in my spreadsheet?

后端 未结 3 548
野的像风
野的像风 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:59

    You can also use installable triggers. If you install an installable trigger (such as onOpen) from your standalone script into the document, it gets similar privileges as if it were a simple trigger.

    And better yet, when the installable trigger calls its function from your standalone script, it executes WITHIN your standalone script! So it can call any other function in your standalone script. Its Logger.log() entries can even be viewed from your standalone script, even though it was executed from your sheets document.

    So basically, if your script installs an onOpen() trigger tied to one of its functions, it's as good as if your Sheets document had required() your whole standalone script file.

    (Assuming the owner of the script has edit privileges to the file.)

提交回复
热议问题