In this article, you'll learn how to import CSV to Firestore or Firebase and build an app that allows users to upload a CSV file into your Firestore database.
Let's quickly import CSV (or XLS, XLSX, JSON) data to Firebase. Firstly, create a new project and connect the Firestore database. Jet automatically syncs and pulls all your data from the existing Firestore collection.
Step 1: Import CSV data or CSV file
Go to your Firestore resource, and then in the Data Editor, choose the Collection into which you would like to import your CSV data. Click the Import button at the top of your Collection.
Drag and drop or choose your CSV file from the file directory.
Step 2: Preview and map your Data
Next, preview the data and verify the field types. You can adjust them as needed. Jet supports over 30 field types, including single-select, multi-select, URL, JSON, and more.
Jet automatically detects the CSV structure and tries to map it with the Collection based on the Column's Names. Verify the mapping and update it if needed: Click on the Column Name and choose a field from Import from the drop-down.
Step 3: Click import data
Finally, click Import and your data will be imported in bulk into your Firestore collection.
Creating the app
Using Jet, you can build an app (internal tool or customer portal) that enables your users to import data by themself without providing access to all of your Firebase Collections and Documents. You can do this in Jet Admin by providing granular permissions to your data, thus limiting who can perform which actions with it.
Go to Visual Builder. Grab a Table and Button components from the right-hand Components panel and drag it to the Canvas to the left. In the right-hand panel, specify Import operation and choose import collection.
Publish your App
Press Preview -> Publish
This tutorial taught you how to import a CSV to Firestore or Firebase using Jet Admin. At this point, you should also understand the basics of Jet and likely see how it could apply to other processes.
For more ideas, check out Jet app templates here, and of course, our docs.