Call functions from another “class” / file

前端 未结 3 1610
执笔经年
执笔经年 2021-02-05 18:03

Ok, I feel embarrassed that I wasn\'t able to figure this out on my own, but after a few wasted hours, I figured it would be easier to simply ask over here:

I have a bun

相关标签:
3条回答
  • 2021-02-05 18:36

    It can do.

    and Corey is right, files is not class.

    Please see below code:

    https://script.google.com/d/1QcyrlnwWGdMnJNxJ2X4qfGeM1q75YxJopPuNKUDgOjmqsp4dilLYtC-A/edit

    0 讨论(0)
  • 2021-02-05 18:41

    Files aren't classes. You can call any functions in any file from any other file. Think of your files as if they were just added together before running. If you want class-like scoping you can use the Libraries feature.

    0 讨论(0)
  • 2021-02-05 18:52

    The following syntax allows you to call any function from within your Google Apps Script project, regardless of whether the function is defined in the same file that is calling it:

    myFunction();
    

    The following code is unnecessary and will throw errors:

    google.script.run.myFunction();
    
    0 讨论(0)
提交回复
热议问题