title: Call parameter through a webapp?
body: <p>The code below gets the distance between 2 different addresses and returns the distance in miles, kilometers or minutes.  My understanding was that I could execute my app-script in a web app using google.script.run.googleMaps();</p>
  
  <p>My question is how do I use input fields as my from and two columns to replicate the same result in a web app?</p>
  
  <pre><code>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 Math.floor(meters * 0.000621371);
        break;
      case "kilometers" :
        return meters / 1000;
        break;
      case "minutes" :
        var duration = getTheLeg["duration"]["value"];
        return duration / 60;
        break;
      default :
        return "Error: Wrong unit type";
    }
  }
  </code></pre>