Import Data

The Import feature enables you to import records from an external Excel/CSV file to database table.

 

How to Use

To enable the feature for a table, select the table and click the Table tab, then enable the Import checkbox.

 

After generation, an Import button will be displayed in the toolbar of the List page.

 

To start importing the external records, click the Import button and an Import dialog box will be displayed. Click the Choose button to select the file for import, and the import process will begin.

After importing, the import result will be shown:

Note that by default the records are NOT saved yet. If you are satisfied with result, press the Save button to save. Otherwise, click the Close button to cancel.

 

Important Notes
  1. Supported import file formats are native Excel spreadsheets (xls/xlsx) and CSV (csv) only. Make sure the file extensions you allowed are included in the Allowed file types (see PHP Settings -> General Options -> File Upload).
  2. The first row of the file should contain the field names to be imported. The field names MUST match the corresponding field names in the table. You can manipulate the field names in the Page_Importing server event (see Server Events for Import) if the file contains pure data only.
  3. All data in the file MUST match the data types of the corresponding field in the table. For example, if you are importing into an Integer field, the data is expected to contain an integer value or the import may fail. You can however modify the field values in the Row_Import server event (see Server Events for Import below). Importing lookup fields from display values is NOT supported, but you can also use Row_Import event to support it in your own ways.
  4. If you are importing a lot of records, the import may take a long time to complete. In that case, you can increase the Import maximum execution time (seconds) in Advanced Settings (see Advanced Settings for Import below).
  5. For CSV file, the default quote character, delimiter and escape character used are " (double quote), , (comma) and \ (backslash) respectively. If your CSV files use different format, you can change them by Page_Importing server event.
  6. To ensure an ALL OR NOTHING import, you can enable the Import records by transaction in Advanced Settings. The transaction will be rollbacked if there is any error during the import process.
  7. The default import operation is "Insert only". If you want also to update records if record with the same record key is found, you can disable the Import records by insert only in Advanced Settings. Please make sure that you understand the implication of this change before modifying the setting.
  8. If User Level Security is enabled, by default only the Administrators has the rights to import records. To allow a non-admin user to import records, use the TablePermission_Loaded server event (see Server Events and Client Scripts) to set an user with Import permission, e.g. $this->setCanImport(true).

 

How to Debug

First, make sure you have enabled [Debug](tools.html?id=debug) and the required settings in your php.ini for displaying errors. Then try to import. If there are errors, you should see error records are highlighted in red and you can view the error by moving your mouse cursor over the record, e.g. ![error](images/importerror.png) If there are server side errors, you can view them under your browser's **EventStream** panel. If you use Google Chrome, press F12, go to the **Network** panel, select the import request, then select the **EventStream** panel. You'll be able to see the import results of each record, e.g. ![eventstream](images/eventstream.png) Then you can check and fix the errors. Since **Debug** is enabled, you can also check PHP errors in the log file.

 

Server Events for Import

**Notes** 1. The **Row_Inserting** and **Row_Inserted** server events will be fired when a record is inserted into the table. 1. If **Import records by insert only** (see below) is disabled, the **Row_Updating** and **Row_Updated** server events will also be fired when a record is updated. 1. Make sure your server events do not interrupt importing. If you want to check if the current action is "import" in the server events, you can check if $this->isImport() returns ``true``.

 

Advanced Settings for Import

 

 ©2002-2025 e.World Technology Ltd. All rights reserved.