Standardise Customer Names in Google Sheets with Apps Script

Customer names often appear in multiple forms across imports, forms and CRM exports. You can standardise them in Google Sheets by combining a small mapping table, clear formatting rules and an Apps Script function that applies those rules consistently.


Start with example pairs

Create an Examples sheet with original and preferred name values, such as “J. Smith” to “John Smith” or “ACME, Inc.” to “Acme Inc”. These pairs help you define the rules and catch exceptions that need review.


Apply rules with Apps Script

Use Apps Script to apply exact mappings first, then general cleanup such as trimming spaces, fixing punctuation and normalising case. Write the result to a new column so the original name remains available.

function standardiseCustomerNames() {
  const ss = SpreadsheetApp.getActive();
  const data = ss.getSheetByName("Customers").getRange("A2:A").getValues();
  const examples = ss.getSheetByName("Examples").getRange("A2:B").getValues();
  const map = {};
  examples.forEach(function (r) {
    const from = String(r[0] || "").trim().toLowerCase();
    const to = String(r[1] || "").trim();
    if (from) map[from] = to;
  });
  const out = data.map(function (r) {
    const name = String(r[0] || "").trim();
    if (!name) return [""];
    const key = name.toLowerCase().replace(/\s+/g, " ");
    if (map[key]) return [map[key]];
    const cleaned = key.replace(/\b\w/g, function (c) { return c.toUpperCase(); }).replace(/\s+/g, " ").trim();
    return [cleaned];
  });
  ss.getSheetByName("Customers").getRange("B2:B" + (out.length + 1)).setValues(out);
}

Adjust the script for titles, suffixes, initials or company naming conventions used in your data. Review ambiguous cases before treating the output as final.


Using Flookup custom functions

If you prefer formulas, Flookup custom functions can help with normalisation and matching. NORMALIZE can clean text in-sheet, and FUZZYSIM, FLOOKUP, ULIST or DEDUPE can support fuzzy matching and deduplication when names vary slightly. The Sheets AI Assistant can also suggest formulas based on your ranges.


Frequently Asked Questions

How do I standardise customer names consistently?

Start with an Examples sheet of original and preferred name pairs, then apply exact mappings first and general cleanup such as trimming, punctuation and case second. Write the result to a new column so the original value remains available.

What can Apps Script do for name standardisation?

A script can read a mapping table, apply exact replacements and then normalise case and spacing across a column. Review ambiguous names before treating the output as final.

Can Flookup help when names vary slightly?

Yes. NORMALIZE can clean text in-sheet, while FUZZYSIM, FLOOKUP, ULIST and DEDUPE support fuzzy matching and deduplication for names that differ slightly.