Logo
Home
Resources

Resources

Blog
Youtube
Template

[GAS Library] Easy Copy-Paste! A Library to Automatically Parse Addresses in Google Sheets into Country, State, and City

Do you ever face the tedious task of managing address lists from various countries like Japan, the USA, and the UK in Google Sheets, wishing you could easily separate them by country, state, or city?

This article introduces "AddressParserLibrary," a Google Apps Script library that automates this data cleaning and parsing process with a single click.

Once you add the library, anyone can easily implement address parsing by making minor adjustments to the provided sample code. We will walk through everything from setup to execution in a step-by-step guide that is clear even for those unfamiliar with programming. Start boosting your daily productivity today!

‍

Demo Video

Over view
Code

Detail

1. Overview

AddressParserLibrary is a Google Apps Script library designed to parse address strings in a Google Sheet into their constituent parts, such as country, city, and postal code. It processes a specified column of addresses in bulk and outputs the results starting from a designated column.

2. Supported Countries

Currently, the library supports the following address formats:

  • United Kingdom (UK)
  • United States (USA)
  • Japan
  • China
  • Canada

3. Library Information

  • Library Name: AddressParserLibrary
  • Script ID: 1J2Vy9PJ1d3f2DvvHfbDUJz3j3XPcDZVOlGVnoJ37pUYqZ68wHaVZCysb

4. Provided Functions

parseAddresses(sheetName, inputColumn, startRow, outputColumn)

Parses the address data in a specified sheet and outputs the results to the same sheet.

Parameters

‍

‍

Return Value

‍

‍

How to Use

Step 1: Add the Library

  1. Open the Script Editor from your Google Sheet.
  2. In the left-hand menu, click the + icon next to "Libraries."
  3. In the "Script ID" field, paste the following ID and click "Look up."

1J2Vy9PJ1d3f2DvvHfbDUJz3j3XPcDZVOlGVnoJ37pUYqZ68wHaVZCysb

  1. Choose the latest version and ensure the "Identifier" is AddressParserLibrary (you can change it if needed).
  2. Click the "Add" button.

‍

Step 2: Execute the Function

Write a script to call the library's function.

Code Example

You can copy and paste the following function into the script editor to get started.

‍

JavaScript
/** * A sample function to parse addresses in a spreadsheet. */
function parseMyAddresses() {  
// --- Parameters ---  
const sheetName = 'sheet1';      
// The name of the sheet containing the addresses  
const inputColumn = 'A';         
// The column where addresses are located  
const startRow = 2;             
// The row where the data begins (assuming row 1 is a header)  
const outputColumn = 'C';        
// The column where the output will start    
// Execute the library 
function  const success = AddressParserLibrary.parseAddresses(sheetName, inputColumn, startRow, outputColumn);    
// Log the result of the execution  
if (success) {    
console.log('Address parsing complete.');  
} else {    
console.log('An error occurred during the process.');  }}

‍

Execution Example

  • Before Execution:
    • Addresses from various countries are listed in column A of a sheet named sheet1, starting from the second row.
  • After Execution:
    • After running the parseMyAddresses function, the addresses from column A are parsed, and the results (country, city, postal code, etc.) are outputted into columns C, D, E, and so on.

‍

Source Code

HTML
CSS
Javascript

Related Template

Need Customization?

We can customize this sample to match your specific business requirements.

Book Free Consultation

[GAS Library] Department Classification Library

The Department Classification Library is an AI-powered automatic classification tool that runs in the Google Apps Script environment. It uses ChatGPT or Gemini to automatically classify company department names into predefined business segments.

Hubspot modules Feature Section Module

This module is designed to visually showcase the features of a product or service by arranging images and text in an alternating layout. It uses scroll-triggered animations to engage users.

‍

How to Build a Reusable "Animated Counter" Module in HubSpot to Showcase Key Metrics

Learn how to implement a custom "Animated Counter" module in HubSpot to visually highlight your company's achievements and KPIs. This guide provides the complete HTML, CSS, JavaScript, and field configuration, allowing you to create a module that is intuitive even for non-developers.

[GAS Library] Automatically Format Phone Numbers in Google Sheets by Country

This guide explains how to use "PhoneFormatter," a convenient Google Apps Script (GAS) library that allows you to batch-format international phone numbers in a Google Sheet. Easily convert numbers into their proper, hyphenated format simply by providing a country name in English, Japanese, or even abbreviated form.

[GAS Library] Easy Copy-Paste! A Library to Automatically Parse Addresses in Google Sheets into Country, State, and City

Do you ever face the tedious task of managing address lists from various countries like Japan, the USA, and the UK in Google Sheets, wishing you could easily separate them by country, state, or city?

This article introduces "AddressParserLibrary," a Google Apps Script library that automates this data cleaning and parsing process with a single click.

Once you add the library, anyone can easily implement address parsing by making minor adjustments to the provided sample code. We will walk through everything from setup to execution in a step-by-step guide that is clear even for those unfamiliar with programming. Start boosting your daily productivity today!

‍

Company Info
Name : SugerTechEnterprise .Inc
CEO :
‍
Tomoo Motoyama

Our ServiceHubspot Solutions
Terms & ConditionsPrivacy Policy

Copyright ©SugerTechEnterprise .Inc

Back To Top Image