How to populate a column with ZIP codes based on addresses in Google Sheets

Опубликовано: 04 Апрель 2026
на канале: Geography Realm
53,275
239

If you have a field containing address information, you can set up a simple function in Google Sheets to be able to populate a separate column with ZIP code data.

Copy and paste code:

function geo2zip(a) {
var response=Maps.newGeocoder()
.reverseGeocode(lat(a),long(a));
return response.results[0].formatted_address.split(',')[2].trim().split(' ')[1];
}
function lat(pointa) {
var response = Maps.newGeocoder()
.geocode(pointa);
return response.results[0].geometry.location.lat
}
function long(pointa) {
var response = Maps.newGeocoder()
.geocode(pointa);
return response.results[0].geometry.location.lng
}

Paste this function in the Google Sheets cell and enter the cell number that contains the first address record in the parenthesis (e.g. =geo2zip(B2)):

=geo2zip()

More:
How to Populate a Cell with the ZIP Code Based on an Address in Google Sheets
https://www.gislounge.com/populate-ce...

Music:
Morning Walk by Unicorn Heads, CC BY 2.0