Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Cannot find active sheet: TypeError: read properties of undefined (reading 'source')

$
0
0

I'm trying to add the current date to a cell in column K when any cell in that respective row is changed.

I found this script and altered it for my situation so I can deploy it as a trigger:

function onEdit(e) {    var sh = e.source.getActiveSheet();    if (sh.getName() !== 'pipeline' || e.range.columnStart == 1 || e.range.columnStart > 10 || e.range.rowStart < 6) return;    sh.getRange(e.range.rowStart, 11).setValue(new Date())}

As you can see I'm searching for tab named pipeline, which exists, it's the 3rd tab in my target sheet.
However, when I click the Google Apps Script Editor "Run" button I get:

TypeError: Cannot read properties of undefined (reading 'source')

Instead of editing the code, I also tried going to my target sheet pipeline and made some changes. When I then check the trigger itself I see that it's being executed but with errors:enter image description here

I then inspect the errors (they're all the same) and see

TypeError: Cannot read properties of undefined (reading 'columnStart')at onEdit(Code:3:48)enter image description here

I read multiple articles recommended by Rubén below, but none of them seems to address my issue (e.g. they address a mismatch in cell values, which I'm not checking for and using forms which I'm not using).

From what I can derive from the error, initially I thought the e parameter was not found, but sh.getName() check is passed, so e seems to be fine.

But I don't see why e.range.columnStart seems to fail.What am I doing wrong?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>