Import CSV file
Importing CSV files allow users to import data easily into Parse tables.
To begin with this tutorial, you will need:
- An app created at Back4App.
First of all, itβs necessary to make sure that you have an existing app created at Back4App. However, if you are a new user, you can check this tutorial to learn how to create one.
In your newly created App, go to the Database Browser and click the Create a class button
Choose to create a Custom class and give it a name. I called mine TestClass but you can call yours anything you like. Remember that by convention classes start with an Uppercase letter, are CamelCase and does not contain special characters such as spaces and symbols. Click Create class when youβre done.
The CSV file must be in the correct format in order to be imported.
Correct format parameters:
- Separation character must be a comma , and NOT a semicolon ;.
- Adjust your Spreadsheet software to output commas as separation characters β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- First line will be the Column Names β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- Parse will automatically convert Strings, Numbers and Booleans β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- Dates must have two columns:β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- ο»Ώdate.__typespecifies the Date type
- ο»Ώdate.isospecifies the Date Format β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- GeoPoints must have three columns: β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- ο»ΏcolumnName.__typespecifies the Geopoint type
- ο»ΏcolumnName.latitudespecifies the Latitude
- ο»ΏcolumnName.longitudespecifies the Longitude β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- Arrays are passed in double quotes β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- Pointers require three columns: β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
- ο»ΏcolumnName.__typespecifies the Pointer type
- ο»ΏcolumnName.classNamespecifies the target class
- ο»ΏcolumnName.objectIdspecifies the objectId of the target class
ο»Ώ
So, for your reference, a few examples:
Three columns: columnStringA will hold strings, columnStringB will also hold strings, columnNumberC will hold numbers
Two columns: columnStringA will hold strings, columnBooleanB will hold Booleans
Two columns: columnStringA and columnStringB will hold strings, columnArrayC will hold arrays
Two columns: columnStringA will hold strings, second column will hold a date in the ISO format
Two columns: columnStringA will hold strings, second column will hold a GeoPoint
You can find a sample CSV file for download here:
For Pointers, please check the example below:
One column: holding a Pointer
In this example, please consider that objectId correspond to the existing ones at the Team class.
Check the sample CSV file for download:
With your newly created class selected in the Database Browser, on the top right corner of the screen, click the Notes button and select Import dataο»Ώ
Click the Upload a file button, choose your CSV file and click the Import button
As CSV files can get quite big, an asynchronous operation is fired to import your data in background, which means you will not see any progress of importing nor success message. At the end of the operation you will receive an email message either telling the operation was successful and your data was imported, or telling the operation wasnβt successful and explaining which columns/lines failed.
If you try to refresh your dashboard before receiving this email, you might see missing data or even no data at all, as the operation is still ongoing.
Once you get the email and if your import was successful, we recommend hard refreshing your browser (CMD + Shift + R on a Mac, CTRL + Shift + R in Windows, both for Chrome) to ensure the new schemas are retrieved and your data displays properly.