Geocode addresses from Excel
There are two reasonable ways. The first needs no code; the second keeps everything inside the workbook. The Addrova API is not live yet, so URLs are the planned ones. [À VÉRIFIER : URL de production]
Way 1: export, geocode, import (no code)
- In Excel, keep one header row and one column with the full address. Save as CSV UTF-8.
- Geocode the file with the CSV geocoder (up to 1,000 rows) or with the batch API for larger files (see batch geocode a CSV).
- Open the result in Excel. New columns hold the label, latitude, longitude, precision, confidence and status.
- Look at the rows with status
uncertainornot_foundbefore trusting the rest.
The CSV tool deletes the job as soon as your result is ready; see the page for exactly what is and is not kept.
Way 2: Power Query, inside the workbook
Power Query can call a web API for each row. In Excel, Data, Get Data, From Other Sources, Blank Query, open the Advanced Editor and use a function like this, then invoke it on your address column. Keep the key out of the sheet: use a parameter. [À VÉRIFIER : exemple testé sur Excel]
(address as text) as record =>
let
key = "YOUR_KEY",
response = Json.Document(Web.Contents("https://api.addrova.eu/v1/geocode", [
Headers = [#"X-API-Key" = key, #"Content-Type" = "application/json"],
Content = Json.FromValue([q = address, limit = 1])
])),
first = if List.Count(response[results]) = 0 then null else response[results]{0}
in
if first = null then [lat = null, lon = null, confidence = "not found"]
else [lat = first[location][lat], lon = first[location][lon], confidence = first[confidence_level]]
Power Query sends one request per row and may refresh often, which uses your quota each time. For long lists, Way 1 is cheaper.
Cautions
- Excel and encodings. Save as CSV UTF-8, or accents will break.
- Postcodes lose their leading zero if Excel treats them as numbers: format the column as text first.
- Personal data. Addresses leave your computer. Addrova writes none to its logs (ZL-10, see the compliance page); your own file and Excel remain yours to protect.
FAQ
Can I do it for a whole country file? Yes, with the batch API; the limits depend on your plan. [À VÉRIFIER : limites par offre]
Is there an Excel add-in? One is planned. [À VÉRIFIER]
Checked by hand: this code runs inside Google Sheets or Excel, so the automated example tests do not execute it. [À VÉRIFIER : essai sur le service réel]