I'm just starting tinkering with scripts for Google Spreadsheet and I have a problem :
How to test if the type of a function's parameter is a range of cells ?
I'd like to do something like this :
if(typeof intput != "range") {
throw "input must be a range";
}
From Google's examples here (middle of the page) :
if (typeof inNum != "number") { // check to make sure input is a number
throw "input must be a number"; // throw an exception with the error message
}
So this seems to be the right way to test the type of a variable. But I don't know how to test if the type is a range of cells.
It'd be even better if I could specify if the range is one or two dimensions.
if(input.length != undefined && input[0].length == undefined)
and it seems to work. – Valona