Get Zip Code automatically from address in Google Sheets
Use Case Scenario:
Our Google Sheet contains hundreds of addresses without ZIP code and we would like to get the zip code for all of the addresses automatically.
Our tutorial on “How to Get Zip Code Automatically from Address” is just what you need! This guide will walk you through the simple steps to set up a function that automatically populates a column with ZIP codes based on address data. Whether you’re managing a customer database or organizing a mailing list, this tutorial will save you time and ensure accuracy in your work. Dive into the world of efficient data handling with our easy-to-follow tutorial!
1. Click on the cell that will display the Zip Code
2. Go to Extensions -> App Script
3. Copy and Paste the function below to your project
function getzip(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
}
4. Rename and Save your Project
5. Go back to your Google Sheet
6. In the selected cell, call the function by typing the function name and followed by the cell location of the address.
=getzip(A2)
7. The function will get the Zip Code from Google’s GeoLocation and display it in the cell.
Thanks , I’ve recently been looking for information about this subject for ages and yours is the
greatest I have found out till now. But, what concerning the
conclusion? Are you certain concerning the source?
My site … nordvpn Coupons inspiresensation (http://ur.link)
350fairfax nordvpn cashback
Hi there just wanted to give you a quick heads up.
The words in your article seem to be running off the screen in Safari.
I’m not sure if this is a formatting issue or something to do
with internet browser compatibility but I thought I’d post
to let you know. The layout look great though! Hope you get the issue solved soon. Many thanks