Learn how to import records from a .csv file in Cobalt.
One of the great features of Cobalt is the possibility to import large amounts of records from a
.JSON file into Cobalt so that you can create automatically new article/items/anything in your site. In addition, it is a smart import. If the users import the same file again, Cobalt will create new articles and update previously imported articles. For example, sellers may import their products’ CSV to update their stock or prices.
Before starting you need a Section and a Type where to import your records. You can find more information about it in the Quick start page.
As many other functions of Cobalt, you work with imports from the frontend of your site. So you need to create a menu item first to acess the import page.
choose Cobalt MenuItem types …
scroll down and choose Import
then select a type you want to limit your imports.
As you can guess you first upload your CSV or JSON file, this is how the import is presented
wait for the upload to complete and click on next. You will now be able to choose an import profile or create a new one. When you create a new profile, the area below will show the parameter fields for the import along with the Fields you created for the Type you specified in the import menu settings (see Step 1 above).
In the Name field, you give the name of the import profile you are creating.
The ID field is the special field you can use to allow updates, but you can also leave it alone selecting “Do not import anything here”. If you use it, select a column of your spreadsheet file with a “unique” name, so that with next imports, if you import selecting again that same “ID”, you will update your records in the DB and create new others if there is something new.
In the Title field you select a column to use to give to each record the title of the article.
The remaining fields are generated based on what you created in the selected Type of the import.
When you have selected all your required fields, click next to finish the process.