Import data from XLS files into an Typo3 database.
Features
- Single file / directory import
- Customizeable column name mapping
- Dafault values for specified columns
- Generate dynamic defalut values like dates / timestamps on the fly
- Customizable value transformig
- Updates for existing rows
- Moving successful / failed files
- Transaction rollbacks on errors
Via Composer
$ composer require ironshark/typo3-data-importer
php vendor/bin/typo3-data-importer import /path/to/file
Option | Example | Description |
---|---|---|
config-file | --config-file="/var/www/typo3conf/localconf.php" | Path to typo3 config file, used for loading database connection info |
column | multiple values allowed --column="last_name:Name" --column="first_name:Vorname" |
Import file column, to db field mapping. Column header name will be used as default database field name, if no mapping configured. Import values from Name column (import file) to last_name field (db) |
table | --table="fe_users" | Database table name, where data should be imported |
map | multiple values allowed --map="gender:Herr:1" --map="gender:Frau:2" --map="gender:Firma:99" |
Field specific value mapping, makes possible to transform values before inserting into the database. For database field gender value Herr will be transformed to 1 |
unique-field | multiple values allowed --unique-field="email" |
Unique field names, to find entities witch could be updated |
default | multiple values allowed --default="pid:1709" --default="usergroup:4" --default="tstamp:{date:U}" |
Default values, to insert values not listed in the import file. |
success-directory | --success-directory="/var/www/import/imported" | Successful imported files will be moved to given directory |
error-directory | --error-directory="/var/www/import/error" | Unsuccessful imported files will be moved to given directory |
--no-trim | Disables value trimming, all values will be trimmed by default |
Name | Example | Description |
---|---|---|
date | --default="tstamp:{date:U}" // 1447057696 --default="tstamp:{date:Y-m-d H:i:s} // 2016-07-26 13:14:51" |
Generate dynamic default value during populating the databse. Format: --default="db_field:{date:php date formar}" |
Usage:
import [options] [--] <data-file>
Arguments:
data-file Path to data file, or directory with files to be imported.
Options:
-c, --config-file[=CONFIG-FILE] Path typo3 configuration file, db configs fill be loaded from this file. [default: false]
--column[=COLUMN] Import file column, to db field mapping in following format db_field:ImportFileColumn (multiple values allowed)
-t, --table[=TABLE] Database table name [default: "fe_users"]
-m, --map[=MAP] Data mapping, transform imported values before inserting in database: "column:source_value:target_value" e.g "gender:Herr:1" (multiple values allowed)
-u, --unique-field[=UNIQUE-FIELD] Unique field names, to find entities witch could be updated (multiple values allowed)
-d, --default[=DEFAULT] Default values, to insert some values not listed in the import file. (multiple values allowed)
--success-directory[=SUCCESS-DIRECTORY] Successful imported files will be moved to given directory if option is set.
--error-directory[=ERROR-DIRECTORY] Unsuccessful imported files will be moved to given directory if option is set.
--no-trim Disables trimming of field values.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php vendor/bin/typo3-data-importer import
--config-file="/var/www/src/typo3conf/localconf.php"
--data-file="import"
--column="last_name:Name"
--column="first_name:Vorname"
--column="gender:Anrede"
--column="email:E-Mailadresse"
--colu="language:Sprachcode"
--column="username:E-Mailadresse"
--map="gender:Herr:1"
--unique-field="email"
--default="pid:1709"
--default="usergroup:4"
--error-directory="error"
--default="tstamp:{date:U}"
--default="password:{date:U}"
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.