TypeError: Cannot read property “source” from undefined

后端 未结 3 1699
不知归路
不知归路 2021-01-17 06:16

I\'ve searched through the forums a few times and I wasn\'t able to suss out an answer to my issue.

I\'m using Google Sheets to track project progress for my team.

相关标签:
3条回答
  • 2021-01-17 07:16

    I think this will work for you,

    var ss = SpreadsheetApp.getActiveSheet();
    var s = ss.getActiveSheet();
    var r = s.getActiveRange();
    

    Let me know if it is working OR not.

    0 讨论(0)
  • 2021-01-17 07:19

    I encountered some similar exception in my app script but in my case, there was a silly mistake, I forgot passing variable reference while calling the method

    function validate(name) {
      if (!codeConstants[name]) {
        Logger.log('Error:' + name);
      }
    }
    
    function init(name) {
      if (!validate())
        return;
    
      // some code....
    }
    

    My validate method call had a trouble it should be changed to

    if (!validate(name))

    0 讨论(0)
  • 2021-01-17 07:20

    Looks that you are running the function from the Script Editor. In this case, event is undefined. To learn about how to test a trigger function see How can I test a trigger function in GAS?

    0 讨论(0)
提交回复
热议问题