To import bulk user data into Firebase Authentication via a CSV file, you can’t directly upload CSV files through the Firebase Console — instead, you’ll need to:
- Convert CSV to JSON format expected by Firebase.
- Use the Firebase Admin SDK (Node.js recommended) or Firebase CLI to import users.
Step-by-step Guide: Bulk Import Users from CSV into Firebase Authentication
🔹 Step 1: Prepare Your CSV File
Example: users.csv
email,password,displayName user1@example.com,Password123,User One user2@example.com,Password456,User Two
🔹 Step 2: Convert CSV to JSON format
You can use a Node.js script to convert and import.
⚠️ Note: Firebase requires passwords to be hashed OR use the
"clearTextPassword"field when using the Admin SDK.
Here’s a simple Node.js script to convert the CSV and import users using Firebase Admin SDK:
📦 Install dependencies
npm init -y npm install firebase-admin csv-parser
🔐 Step 3: Setup Firebase Admin SDK
- Go to Firebase Console > Project Settings > Service Accounts
- Click Generate new private key, and download the JSON file (e.g.,
serviceAccountKey.json)
🔄 Step 4: Import Script (Node.js)
// importUsers.js
const admin = require("firebase-admin");
const fs = require("fs");
const csv = require("csv-parser");
admin.initializeApp({
credential: admin.credential.cert(require("./serviceAccountKey.json")),
});
const users = [];
fs.createReadStream("users.csv")
.pipe(csv())
.on("data", (row) => {
users.push({
email: row.email,
password: row.password,
displayName: row.displayName,
});
})
.on("end", async () => {
console.log("CSV file successfully processed. Starting import...");
for (const user of users) {
try {
await admin.auth().createUser(user);
console.log(`✅ Created user: ${user.email}`);
} catch (error) {
console.error(`❌ Failed to create ${user.email}:`, error.message);
}
}
console.log("🎉 All done.");
});
Run the script:
node importUsers.js
🔹 Step 5 (Alternative): Use Firebase CLI for Hashed Passwords
If you have password hashes (from another system), you can import using:
firebase auth:import accounts.json --hash-algo=scrypt --hash-key=BASE64_KEY --rounds=8 --mem-cost=14
Refer: https://firebase.google.com/docs/auth/admin/import-users
⚠️ Notes
- The Admin SDK method supports clear text passwords (only while creating).
- If importing from another system and you have hashes, you must use the CLI and proper hash configuration.
- Always handle sensitive data like passwords securely — avoid exposing CSV files with plain passwords.
Would you like a ready-to-run example repo or script for your specific CSV structure?