How To Import A CSV Into Your Database (Complete Guide)

In this guide, you’ll learn how to import data from a CSV into your own Bubble database.

If you have data stored in an external tool or service, this method allows you to easily migrate this data across.

The process of uploading data from a CSV into a Bubble database includes:

  1. Correctly formatting the data within a CSV spreadsheet
  2. Uploading the CSV data into Bubble and mapping the relevant fields
  3. Previewing the data within your Bubble database

Full Transcript of Tutorial

1. Formatting the data within a CSV spreadsheet

In our example today, we’re going to preview a sports management app built in Bubble. As the application is brand new, there’s currently no existing data within the database. 

At this point, however, we have a list of existing data stored in an external spreadsheet. This data contains a list of coaches that are customers of our sporting app.

Within the spreadsheet, you’ll see that I’ve taken the time to structure this data into columns. Each column has an allocated title e.g. the name, price, and bio for each individual coach.

Based on the structure of your spreadsheet, you’ll need to configure your Bubble database to accommodate each of these columns.

When setting up your Bubble database, each data field must be set to the relevant type of information within your spreadsheet. For example, our price field will contain a dollar value, so this means within Bubble, we’ll need to set this field as a number.

The same principle would also apply to any kind of data e.g. dates, images, files, etc.

2. Uploading the CSV data into Bubble and mapping the relevant fields

Now that we’ve taken the time to properly structure our spreadsheet, we can now upload this CSV data into Bubble.

To get started, open the data tab in your Bubble editor. Within this tab, select the ‘app data’ menu. Inside this menu, you’ll now see an option to ‘upload data’. 

When you click this button, it will display a popup that allows you to prepare for the upload.

To start, simply select the type of data you’d like to upload. Open the dropdown menu and select the relevant data type from your database. 

In our example today, we’ll select the ‘coaches’ data type as we’ll be uploading a list of coaches.

After selecting the data type, we can then choose to upload a CSV file from our local device. 

Once the file has uploaded, Bubble will automatically attempt to map the fields from your CSV. If the titles of each column in your spreadsheet are spelled the exact same as your data fields, Bubble will automatically match these.

As you’ll notice, you do still have the ability to manually select which fields should be linked.

During the process of mapping your fields, Bubble will notify you if there’s not a distinct match between your CSV and the database. 

If, for example, you tried to upload a currency directly from a CSV, Bubble will display an error message prompting you to format this as an integer.

Finally, after configuring our CSV import, we can select the ‘upload’ button. Bubble will then display a progress bar as it uploads the data into your database.

The processing of uploading data will vary based on how many entries are stored within your CSV.

3. Previewing the data within your Bubble database

Once our upload is complete, we can now verify the CSV import within our database.

By selecting the ‘app data’ menu, you’ll see that all the entries from our CSV were successfully imported. If we open an individual entry, you’ll also see the values stored under each data field.

And just like that, you now know how to upload data from a CSV spreadsheet directly into your Bubble database.

Never miss a course 👇