Reputation: 61
I'm trying to write a line to terminate my script if a given range includes more than one cell. However, when a multi-cell range is passed in, my conditional statement does not trigger.
I went ahead and used the logger to see what was returning with these methods.
Logger.log("Width: " + range.getWidth);
Logger.log("Height: " + range.getHeight);
if((range.getWidth > 1) || (range.getHeight > 1)) return;
The range variable has a 35-row and 1-column range, so getHeight should give me 35, and the conditional should be triggered. However, this is what's showing in the logs:
[19-08-18 15:37:17:179 EDT] Width: function getWidth() {/* */}
[19-08-18 15:37:17:180 EDT] Height: function getHeight() {/* */}
It looks like the Google functions are commented out. These methods are supposed to return an integer. Is this a known current bug with Google Apps Script or am I just doing something wrong here?
Upvotes: 1
Views: 582
Reputation: 50443
As you can see in the Logger
, range.getWidth
is a function. You're getting a function, but not running/calling it. getWidth
function should be executed to give width as a result.
range.getWidth();
Upvotes: 2