How to convert csv to json for firestore bulk import
- Step 1Export your data as CSV — Pull the records to seed into a UTF-8 CSV with a header row.
- Step 2Convert to a JSON array — Drop the CSV here, pick 'array of objects', and toggle on type inference.
- Step 3Drop the JSON into your seed script — Read the file with require() or fs.readFile, then iterate calling firestore.collection('x').doc(id).set(record).
- Step 4Run the seed against your environment — Run the seed against the emulator or staging project before touching production.
Frequently asked questions
Does Firestore have a 1 MB document limit?+
Yes — each document is capped at 1 MB. Avoid building one giant grouped JSON document; keep each record as its own Firestore document.
How do I assign document IDs?+
Include an id column in the CSV. In the seed script, use that field as the doc() argument and remove it from the body if you do not want to duplicate it.
Can the file include nested objects?+
CSV is flat, so nested fields need pre-processing or grouped output. Or convert to JSON first and edit the file before seeding.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.