In a cell in my google sheet, I call my function like this: myFunction(A1:A3), where A1 = 5, A2 = 7 and A3 = 3. I now want to loop over the input (A1, A2, and A3) and (for example) sum them.
function myFunction(input) {
if (!input.map) {
return -1;
}
var sum=0
for(var i=0; i<input.length; i++){
sum = sum + parseInt(input[i]);
}
return sum
}
But it only returns the value in A1 (5) because input.length returns 1.
If I remove parseInt(input[i]), it returns "05,7,3"
What am i doing wrong?
=SUM(A1:A3)?