Skip to content

Instantly share code, notes, and snippets.

@jgraup
Last active December 28, 2015 17:59
Show Gist options
  • Save jgraup/7539364 to your computer and use it in GitHub Desktop.
Save jgraup/7539364 to your computer and use it in GitHub Desktop.
Google Spreadsheet Formulas - Current Date and Time - Convert a City,State into Lat/Lon | Geocoding from: http://open.mapquestapi.com/geocoding/#parameters
## Current Date/Time in Cell
=NOW()
## GOAL: Convert A2 into lat/long cords in B2
## Geocoding from: http://open.mapquestapi.com/geocoding/#parameters
## Cells [A:Location] [B:Final GeoLocation]
A2 = Los Angeles, CA
B2 = 34.0536781,-118.2427025
## First, get the cell data to the left of the output cell
=INDIRECT(ADDRESS(ROW();COLUMN()-1))
## Then use it for the query term. XPath will pull the lat/lon from the xml while JOIN stitches it together.
## Paste the final result in B2
=JOIN(",", ImportXML(CONCATENATE("http://open.mapquestapi.com/nominatim/v1/search?format=xml&q=",INDIRECT(ADDRESS( ROW();COLUMN()-1))), "//place[1]/@lat | //place[1]/@lon"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment