Fork me on GitHub
Eonza automation software - free, open source cross-platform program for easy creation and management of scripts.

Import data

You can import data from CSV and Excel XLSX files to any of tables in the Eonza information storage. Both formats are widely used and are convenient to store information. If you store information in another format, you surely can find a way to convert the data to one of these formats. The import process consists of two steps: at first, you load the file itself, then for each N-th parameter or cell you specify a corresponding field of the table to import data to.

Destination table - Shows the name of the table the data are imported to.

Source file - Shows the name of the loaded file the data re imported from.

Supported formats - Specifies supported file formats to import data.

Encoding - Specifies encoding of the loaded file. To import XLSX files, leave the UTF-8 encoding.

After uploading the file to the server, the script determines the number of parameters in one record and returns the first record. Loading from a CSV file automatically determines the separator symbol. Data are not imported yet, because we didn’t specify cell (parameter) index number and table column matching. If the file is loaded successfully, you should see the following form:

For each parameter you should specify a field of the table the given value should be imported to. If the field isn’t specified, values with this particular index number are ignored during further importing. To avoid mistakes, the right column shows values from the first loaded record. By default, imported records are added to the DB, but if you specify the ID field, the record with the specified ID is updated, otherwise a new record is added. Let’s take a look at the below example. Suppose, we have a table

ID,Name
1,Apple
2,Orange
3,Peach

After importing the following csv

2,Grapes
6,Pineapple

If the ID is specified for the first field and Name for the second one, the table will have the following records

1,Apple
2,Grapes
3,Peach
6,Pineapple

If we import data from the second field only, we will get the following table data

1,Apple
2,Orange
3,Peach
4,Grapes
5,Pineapple

As you finish specifying the required matches, click the Import button. If the data were imported successfully, you should see a message telling you the number of add or updated records. We strongly recommend to make a backup copy of the database before importing information from CSV and Excel XLSX files.