Bulk UUID Generation: 100+ UUIDs for Seeds, Imports, and Spreadsheets
- Generate bulk UUIDs in one command with Python, Node.js, Bash, or PowerShell.
- For CSV imports, generate a UUID column alongside your data using awk or Python.
- Database seeds in Rails, Laravel, and Django can use built-in UUID functions rather than pre-generated lists.
- The fastest approach for quick ad-hoc bulk UUIDs is a one-liner in the terminal.
Table of Contents
Sometimes you need 50 UUIDs for a database seed file, 200 for a CSV import, or 1,000 to pre-populate a test environment. Clicking "generate" one at a time is not practical. This guide covers every efficient approach: terminal one-liners, script snippets, spreadsheet formulas, and how to add a UUID column to an existing CSV file.
Terminal One-Liners: Generate N UUIDs Instantly
Python (any platform):
# Generate 50 UUIDs, one per line
python3 -c "import uuid; [print(uuid.uuid4()) for _ in range(50)]"
# Save to a file
python3 -c "import uuid; [print(uuid.uuid4()) for _ in range(100)]" > uuids.txt
Node.js:
node -e "const {v4}=require('uuid'); for(let i=0;i<50;i++) console.log(v4())"
Linux/macOS with uuidgen:
# Generate 50 UUIDs
for i in $(seq 1 50); do uuidgen; done
# Save to file
for i in $(seq 1 100); do uuidgen; done > uuids.txt
PowerShell (Windows):
1..50 | ForEach-Object { [System.Guid]::NewGuid().ToString() }
# Save to file
1..100 | ForEach-Object { [System.Guid]::NewGuid().ToString() } | Out-File uuids.txt
Add a UUID Column to an Existing CSV File
If you have a CSV export and need to add a UUID primary key column to each row:
# Python approach — adds 'id' column as first column
import csv
import uuid
with open('input.csv', 'r') as fin, open('output.csv', 'w', newline='') as fout:
reader = csv.DictReader(fin)
fieldnames = ['id'] + reader.fieldnames
writer = csv.DictWriter(fout, fieldnames=fieldnames)
writer.writeheader()
for row in reader:
row['id'] = str(uuid.uuid4())
writer.writerow(row)
Or with awk (Linux/macOS):
# Add UUID as first column (requires uuidgen)
# Note: generates one UUID per row using a subshell
awk 'NR==1 {print "id," $0; next} {cmd="uuidgen"; cmd | getline uuid; close(cmd); print uuid "," $0}' input.csv > output.csv
The Python approach is faster for large files since it doesn't spawn a subprocess per row.
Sell Custom Apparel — We Handle Printing & Free ShippingGenerate JSON Seed Files with UUIDs
For database seed files in JSON format:
import uuid
import json
from datetime import datetime, timezone
def make_order(i):
return {
"id": str(uuid.uuid4()),
"customer_email": f"user{i}@example.com",
"total": round(10 + i * 5.50, 2),
"created_at": datetime.now(timezone.utc).isoformat(),
}
orders = [make_order(i) for i in range(1, 101)]
with open('seeds/orders.json', 'w') as f:
json.dump(orders, f, indent=2)
print(f"Generated {len(orders)} orders")
This creates 100 order records, each with a unique UUID and realistic data. Adjust the factory function for any schema.
UUID in Google Sheets and Excel
Neither Google Sheets nor Excel has a native UUID function, but both support workarounds.
Google Sheets — formula approach:
=LOWER(DEC2HEX(RANDBETWEEN(0,4294967295),8)&"-"&DEC2HEX(RANDBETWEEN(0,65535),4)&"-4"&DEC2HEX(RANDBETWEEN(0,4095),3)&"-"&DEC2HEX(RANDBETWEEN(32768,49151),4)&"-"&DEC2HEX(RANDBETWEEN(0,281474976710655),12))
This generates a UUID v4-shaped string. Note: it uses RANDBETWEEN, which is not a CSPRNG — suitable for test data, not for security-sensitive IDs.
For bulk spreadsheet UUIDs, the fastest approach is to generate them outside the sheet and paste as values:
python3 -c "import uuid; [print(uuid.uuid4()) for _ in range(200)]" | pbcopy # macOS — copies to clipboard
Then paste into the UUID column and use "Paste special → Values only" to prevent re-evaluation.
Database Seeds in Rails, Laravel, and Django
For framework seed files, generate UUIDs programmatically rather than hardcoding them:
Rails (db/seeds.rb):
100.times do |i|
Order.create!(
id: SecureRandom.uuid,
customer_email: "user#{i}@example.com",
total: (10 + i * 5.5).round(2)
)
end
Laravel (database/seeders/OrderSeeder.php):
for ($i = 0; $i < 100; $i++) {
Order::create([
'id' => Str::uuid(),
'customer_email' => "user{$i}@example.com",
'total' => round(10 + $i * 5.5, 2),
]);
}
Django (management command):
for i in range(100):
Order.objects.create(
customer_email=f"user{i}@example.com",
total=10 + i * 5.5,
# id auto-generated by UUIDField default=uuid.uuid4
)
In all three cases, the UUID is generated fresh per record — no pre-generated list needed. Use the free UUID generator above for one-off test values in Postman or manual database console inserts.
Need a Quick UUID? Generate One Above
The Cheetah UUID Generator produces one RFC-compliant UUID v4 at a time — for bulk generation, use the terminal one-liners above.
Open Free UUID GeneratorFrequently Asked Questions
What is the fastest way to generate 1,000 UUIDs?
Python one-liner: python3 -c "import uuid; [print(uuid.uuid4()) for _ in range(1000)]" — generates 1,000 UUIDs in under a second. Redirect to a file with > uuids.txt.
Can I generate UUIDs directly in SQL for bulk inserts?
Yes. PostgreSQL: gen_random_uuid() in a SELECT or INSERT. MySQL 8+: UUID() function. SQL Server: NEWID(). Use these in a loop or INSERT ... SELECT to generate bulk UUIDs without leaving the database.
Are Google Sheets RANDBETWEEN UUIDs safe to use in production?
No — RANDBETWEEN uses a non-cryptographic PRNG and recalculates on every sheet change. Use them for test data display only. For any real data, generate UUIDs in code.
How do I generate unique UUIDs across multiple CSV files?
UUID v4 collision probability is astronomically low — independently generated UUIDs across files will not collide. Just generate them independently per file; no coordination needed.

