Skip to content

Instantly share code, notes, and snippets.

View scevissers's full-sized avatar

Sebastiaan Vissers scevissers

  • Zwijndrecht
View GitHub Profile
@simonwhatley
simonwhatley / GoogleDistance.gs
Last active February 27, 2023 14:21
Get the distance between 2 addresses in Google Sheets using Google Maps
/**
* Get the distance between 2 different addresses.
* @param {string} origin_address The origin/start address as string Eg. "102 Petty France, London, SW1H 9AJ".
* @param {string} destination_address The destination/end address as string Eg. "10 Whitechapel High Street, London, E1 8QS".
* @param {string} travel_mode The mode of travel as string. Default: DRIVING. Options: BICYCLING, TRANSIT, WALKING.
* @param {string} return_type The return type as string. Default: MILES. Options: KILOMETERS, MINUTES, HOURS, STEPS.
* @return the distance between 2 different addresses.
* @customfunction
*/
function GOOGLEDISTANCE(origin_address,destination_address,travel_mode,return_type) {