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.
This is a Google Apps Script library for batch-formatting phone numbers in a Google Sheet to the appropriate format (e.g., with hyphens) based on their country.
The library reads phone number and country name data from specified columns in a sheet and writes the formatted phone numbers to a designated output column.
formatSpreadsheet(sheetName, phoneCol, countryCol, outputCol, startRow)
Formats the phone numbers within a spreadsheet.
Parameters:
Return Value:
Integer
: Returns the number of phone numbers processed.Note on Country Names:
Japan
), abbreviations (e.g., US
), or in Japanese (e.g., 日本
).+
icon next to "Libraries."1kL3K8a9qUz4yQWTNls0arDHy6bkhmtqeseWp4uYxXFjL9Fjy6ADR6VIU
PhoneFormatter
).Use the sample code below, modifying the parameters to fit your sheet's layout.
JavaScript
function formatPhoneNumbers() {
// Configure the parameters
// 1. Sheet Name: The name of the sheet containing the phone numbers.
// 2. Phone Column: The column with the phone numbers (1 for A, 2 for B, etc.).
// 3. Country Column: The column with the country names (1 for A, 2 for B, etc.).
// 4. Output Column: The column where formatted numbers will be placed (1 for A, 2 for B, etc.).
// 5. Start Row: The row number where your data begins (e.g., 1 if there's no header).
var count = PhoneFormatter.formatSpreadsheet('Sheet1', 1, 2, 3, 1);
// Log the number of processed items
console.log(count + ' phone numbers were processed.');}
formatPhoneNumbers
.
We can customize this sample to match your specific business requirements.
Book Free ConsultationThe 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.
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.
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.
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.
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!