How to add the upload csv tool

Posted on April 2, 2020

From version 1.12.1 you can add the upload csv tool, with this tool you can create or update massively registries on a table.

How to add the tool in a content table

Let's use for example the post table. At the schema file /src/core/tables/post.php change the tools value:

  'tools'=>['add','csv','uploadcsv'],

And add a new lline, uploadcsv list is used from the tool in order to know which table columns can be updated.

  'uploadcsv'=> ['id','title','slug','user_id','publish','post'],

Now at /admin/content/post you can se the new tool button "Upload CSV"

 

How to use the tool

When you click on the tool it with show 3 steps to follow:

  1. Download the template file for the table
  2. Edit the csv file on your favoritor stysheet editor. Your quotation character should be the double quotes. You can leave the values of ids blank, so on the upload, the system with generate its own the id keys. Leaving blank values for other columns, they will be set with their default values.
  3. Last step is to upload the file. When the proccess ends the table will be updated and you can instantly see the changes.