Estou tentando configurar uma planilha do Google onde posso fazer beicinho em dois endereços e obter a distância e o tempo percorrido do Google Maps na planilha do Excel
Eu tenho o script abaixo - mas ele continua apresentando um erro - o erro é Exception: Invalid argument: origin GOOGLEMAPS @GOOGLEMAPS.gs:4
Meu script está abaixo
your text
`function GOOGLEMAPS(start_address,end_address,return_type) {
var mapObj = Maps.newDirectionFinder();
mapObj.setOrigin(start_address);
mapObj.setDestination(end_address);
var directions = mapObj.getDirections();
var getTheLeg = directions["routes"][0]["legs"][0];
var meters = getTheLeg["distance"]["value"];
switch(return_type){
case "miles":
return meters * 0.000621371;
break;
case "minutes":
//get duration in seconds
var duration = getTheLeg["duration"]["value"];
//convert to minutes and return
return duration / 60;
break;
case "kilometers":
return meters / 1000;
break;
default:
return "error:wrong unit type";
}
}`