Vigyata.AI
Is this your channel?

Generate Short Random Codes or IDs

115 views· 5 likes· 14:34· Apr 27, 2026

🛍️ Products Mentioned (2)

Generate Unique Short ID Codes in Google Sheets with Apps Script (Custom Menu + Duplicate Check) Coding Course: https://bettersheets.co/courses/spreadsheet-automation-101 Get Sheet and Code: https://docs.google.com/spreadsheets/d/1F7FlV6JjMphU9NVPyVgCmnq_QUOyAFKdi-vcxzXKUCg/copy This video shows how to use Google Sheets Apps Script to generate short ID codes (custom lengths of letters and numbers) and ensure they’re unique by checking for duplicates in an existing column. It walks through creating an Apps Script project, adding a custom menu item (“Create code”) with an onOpen function, building helper functions to generate randomized strings from customizable character sets (including weighting certain characters by repeating them), and testing those functions in-sheet. It then demonstrates assembling a code format (e.g., 3 letters + hyphen + 1 number), using a do/while loop to regenerate if the code already exists in column A, and writing the final code into the current row’s A column via setValue. It also covers customizing allowed characters (excluding ambiguous ones) and notes code-space limits for short IDs. 00:00 Short Codes Overview 00:54 Plan and Pseudocode 01:48 Custom Menu Setup 02:43 Random Character Generator 05:15 Random Number Generator 06:13 Test Functions in Sheet 07:01 Build Unique Code Logic 09:00 Do While Duplicate Check 09:53 Write Code via Menu 11:21 Customize Characters and Format 12:47 Limits and Performance Tips 13:41 Course Plug and Wrap Up

🎬 More from Better Sheets