I am very new to using Google Scripts. I am having this very basic problem, but I can't seem to find an explanation. I programmed a function on a Google Sheets (opening the script editor from the same sheet in which I want to try the code). It turns out that when I want to use my function, Google Sheets doesn't find it. That means, when I type "=" plus the name of the function, I can't find it. My code is the following:
function distance(origin,destination) {
var mapObj = Maps.newDirectionFinder()
mapObj.setMode(Maps.DirectionFinder.Mode.DRIVING)
//Set the Orgin
mapObj.setOrigin(origin)
//Set the Destination
mapObj.setDestination(destination)
//Retrieve the Distance
var directions = mapObj.getDirections();
var meters = directions["routes"][0]["legs"][0]["distance"]["value"];
}
I would appreciate any help!!