Logo
Home
Resources

Product

Custom Workflow

Resources

Blog
Youtube
Template
Home
>
Product
>
Template Top
>
detail

[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

FAQ

Does the count-up animation start the moment the page loads?

No, not the moment the page loads. As explained in the "Implementation Points," the animation that counts up from 0 starts only when the visitor scrolls down and this module enters the browser's screen (the viewport).

Can I set the "Number" to be red and the "Title" to be black, using different colors?

No, you cannot. According to the "Detailed Input Fields" in this article, this module provides only one color picker called "Text and Number Color (text_color)." This setting is used to change the color of all text elements (Title, Number, and Suffix) all at once.

If I set up three counters side-by-side, how will they display on a smartphone?

On a smartphone (a small screen), they will automatically switch to a vertically stacked layout instead of being side-by-side. As explained in the "Implementation Points," the module uses CSS Flexbox with flex-wrap: wrap, allowing it to respond automatically to the screen size.

Search

Search more

Related Template

Need Customization?

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

Book Free Consultation

HubSpot Custom Workflow Guide: How to Auto-Search and Recommend Marketing Events

HubSpot Custom Workflow Guide: How to Auto-Recommend Files with Generative AI

HubSpot Custom Workflow Guide: How to "Search" for Marketing Campaigns and Use Their Data

HubSpot Custom Workflow Guide: How to "Search" for Tickets and Auto-Associate Contacts

HubSpot Custom Workflow Guide: How to "Search" for Deals and Auto-Associate Contacts

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

HomeTemplateCustomWorkflow
Terms & ConditionsPrivacy PolicyContact us

Copyright ©SweetsVillage .Inc

Back To Top Image