Bulk import data to Bubble.io with EasyCSV
How to use EasyCSV to bulk import records into your Bubble.io database.
How to connect Bubble.io and EasyCSV
Follow the steps below and we will be using the Bubble.io Bulk Create API
- Log into EasyCSV
- Create or go to the import page you have set up for importing your spreadsheets.
- After the page is created, click the "Sheet Details" link at the top of the page.
- Under the section, "Where to send import data?" click the checkbox for "Post imports to an API / Webhook".
- Type/paste a matching URL to these examples:
// This is the base template Bubble.io gives https://appname.bubbleapps.io/api/1.1/obj/typename/bulk // Let's say you have an app named 'photo-test', and the Bubble.io database object is 'teacher', and you want to import for your TEST/DEVELOPMENT app environment. The URL should look like this. https://photo-test.bubbleapps.io/version-test/api/1.1/obj/teacher/bulk // Let's say you have an app named 'photo-test', and the Bubble.io database object is 'teacher', and you want to import for your PRODUCTION/LIVE app environment. The URL should look like this. https://photo-test.bubbleapps.io/api/1.1/obj/teacher/bulk // Let's say you your own domain 'myapp.com', and the Bubble.io database object is 'teacher', and you want to import for your TEST/DEVELOPMENT app environment. The URL should look like this. https://myapp.com/version-test/api/1.1/obj/teacher/bulk // Let's say you your own domain 'myapp.com', and the Bubble.io database object is 'teacher', and you want to import for your PRODUCTION/LIVE app environment. The URL should look like this. https://myapp.com/api/1.1/obj/teacher/bulk
- Click the checkbox labeled "Post multiple records at once in bulk chunks"
- In the "Number of records to post per bulk chunk" field enter "50" to start. Your Bubble.io plan will dictate how many records you will want to post at once. You can read our recommendations for how many to post given your plan here.
- Click the "Save" button.
- At the top of your import page, click the link "Request Headers".
- Add a new request header.
- For the "Key" field type: Authorization
- For the "Value" field type: Bearer {your api key}
- Replace {your api key} with the API key you get from Bubble.io for you app. You can find your API key by going to your Bubble app on Bubble.io. Click the gear icon labeled "Settings" on the left-side of the page > then click "API" in the top tabs.
- Under the section "API Tokens" click to generate a new API token. Once that token is generated paste it back into your EasyCSV request header.
- In your Bubble.io app settings, in the "API" area, make sure you have all checkboxes checked for exposing the Data API and also checked for every database object you want to import for.
- Click the "Save" button.
- Follow the steps below to map spreadsheet column names to Bubble.io database fields.
How do I map spreadsheet column names to Bubble.io database?
- Log into EasyCSV
- Create or go to the import page you have set up for importing your spreadsheets.
- After the page is created, click the "Customize JSON to Post" link at the top of the page.
- Click the button on the right to "Use all fields in Custom JSON".
- Delete all EasyCSV standard fields. This way there are only fields from the spreadsheet that map 1-to-1 to columns/attributes for your database object in Bubble.
- Change the Key values in the JSON to EXACTLY match the database column name/attribute. Make sure you pay attention to upper and lower case letters on Bubble and match them in EasyCSV
- Click the "Save" button.
- You can now upload your CSV files or Google Sheets into your Bubble.io database!
Example custom JSON:
{
"Firstname": "{{ FIRSTNAME }}",
"Lastname": "{{ LASTNAME }}",
"Grade": "{{ GRADE }}",
"Teacher": "{{ TEACHER }}",
"Password": "{{ PASSWORD }}",
"School": "{{ SCHOOL }}"
}
Why do I have some of my records fail with 524 errors when posting to Bubble.io Bulk Create API?
The number of records being POSTed per chunk being imported is too large for you Bubble.io monthly plan.
The higher your Bubble.io monthly plan value, the more records you can post in each chunk to the Bulk Create API that Bubble exposes.
Please follow the chunk size guidelines below for how many records you should try posting per plan.
More details: The Bubble.io Bulk Create API receives a number of records per call. If you POST too many records in each call Bubble will time out and return a 524. They will not say how many records import and how many fail. Often we found Bubble will import some but not all. The safest thing to do is follow the recommendations below.
What bulk records count chunk size should I choose for my Bubble.io plan?
- Hobby/Free plan: 50
- Personal plan: 150
- Professional: Try testing some imports and find a value over 150 where it will not fail any records.
- Production: Try testing some imports and find a value over 200 where it will not fail any records.
Why does my upload fail with unknown column name errors?
Bubble.io databases are very picky. The Key values in the custom json you are POSTing from EasyCSV need to EXACLY match what is in your Bubble.io database.
Check the following things:
- Make sure there are no extra keys in the custom json in EasyCSV that do NOT map to a column/attribute for your Bubble.io database object. Bubble does not like extra keys/columns it's database doesn't know about.
- The keys in the custom json EXACTLY match the column names in your Bubble.io database object. Verify that capitalization and spaces are exactly the same in the custom json in EasyCSV and your Bubble.io database object.
- In your Bubble.io app settings, click "API" and make sure you have all checkboxes checked for exposing the Data API and also checked for every database object you want to import for.