The question: https://stackoverflow.com/review/low-quality-posts/17716516 displays a code block and asks
Code blows on MailApp line with message "invalid email: Range". I don't understand the error message. Please help.
To which I responded with:
The error is saying that your var Addr = dataRange.getCell(1, 11); call is getting a result of a Range, so when you pass that to the sendEmail function it says Invalid email and shows the value to be Range.
You can confirm this by console.log(Addr); before the call.
The question asked for the meaning of the error message, I believe @Barmar has provided the cause in his comment that you are referencing the title of the column instead of the current row due to using '1' instead of 'i'.
Yet one low-quality-posts reviewer wrote
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
I'm struggling to understand how that review is valid, the question is answered, I edited my post when further information was provided by @Barmar to keep it as complete as I could and gave him credit for it, I would delete mine if he came back and added his own answer, but now someone else will write the same thing.
Can anyone give me some insight into why my post was deleted so I can avoid the unpleasant way I am feeling in future?
console.log(Addr);
. You could also repeat the correct line of code at the end, saying something like: You fix the error by doing [code here] assuming the proposed fixes from the comments indeed fix the root cause1
indataRange.getCell(1, 11)
maybe should be ani
, this is not the cause of the error message. As Phil rightly points out in his comment, all thedataRange.getCell(...)
statements need to be changed todataRange.getCell(...).getValue()
. This is clearly a useful question for people (like the OP) who don't understand thatgetCell()
returns aRange
object and not the actual value of the cell.