r/googleads • • 4d ago

Tools Free Google Sheets script to normalize, validate & SHA-256 hash Enhanced Conversions before CSV import

Sharing a small Google Apps Script I put together for prepping offline conversions and lead lists in Google Sheets before uploading the CSV to Google Ads.

When uploading manually without a CRM integration or Zapier, match rates usually drop because raw CRM exports have things like Gmail dots or +aliases, local phone numbers without E.164 country codes, or random formatting errors that break the batch. Most free scripts I found online just overwrite your raw cells in-place, which gets messy fast.

This runs locally inside your active Sheet (no external API calls or third-party servers, scoped strictly to the current document):

  • Leaves your original tab alone and creates two new tabs: GAds_Hashed for clean rows ready to download as CSV, and GAds_Flagged for anything with errors or duplicates (with the source row number and reason).
  • Normalizes before hashing: strips Gmail dots and +tags, converts local phone numbers to E.164 using the row's country column, and cleans up casing/spaces on names and locations.
  • Hashes only the PII match keys (Customer Email, Mobile, First Name, Last Name, City, State) and leaves GCLID, Country, Postal Code, timestamps, and conversion values as-is.
  • Validates country codes, ISO currencies, and timestamps before hashing so bad rows get caught upfront.

Code and column header instructions are in this Gist if anyone wants to copy-paste it into Extensions > Apps Script:https://gist.github.com/roy2026-creator/7e3651b024361e2f221c3a159242aeae

3 Upvotes

8 comments sorted by

1

u/welcometosilentchill 4d ago

This rules. I ended up making my own but am glad there are more available resources out there. Much nicer handling the hashing internally than as part of an upload and trying to reverse engineer the issue based on google’s error reports.

1

u/roy1979 4d ago

Thanks

1

u/This-Structure-5210 4d ago

pasting a stranger's apps script into the sheet with your entire customer list. no thanks. match rates are bad because your form asks for a phone number nobody fills in, not because of gmail dots

1

u/roy1979 4d ago

I agree on the stranger's app script part. If you are not comfortable with code, one should definitely stay away from these things..
On the other, I don't agree with. This is in case your form number is filled but because of incorrect hashing, it doesn't match.

1

u/tambooby 3d ago

does the phone normalization rely on a full country column, or can it fall back to a default country code if that field is blank? raw lead exports are almost always missing country data tbh

1

u/roy1979 3d ago edited 3d ago

Right now it requires the country column unless the number already has a + or 00 prefix, otherwise it gets flagged in the error tab instead of guessing a country code. Our data always had Country populated so I didn't factor in blank-country exports, though I can add an optional default country config line at the top for single-country lists if that helps.

1

u/Level_Big8615 1d ago

nice, keeping the raw columns untouched is the part people always skip, but hashing a bad phone number just gives you a perfectly hashed bad phone number lol

1

u/roy1979 1d ago

Bad phone numbers don't get hashed, they will be in flagged tab.