Import Documents
Import documents using the Magento Import UI or via CLI.
Import Process
Step 1: Prepare CSV File
Create a CSV file with the required columns. See CSV Format for details.
Step 2: Provide Files (new documents)
For new documents, path must point to a real file on disk (relative to Magento root). Example:
var/import/customerdocuments/test_1.pdfDuring import, the file is copied into the configured upload folder (customerdocuments/general/upload_path) and the stored document path is updated.
Step 3: Run Import
Via Admin:
- Go to System >Data Transfer > Import
- Select Entity Type: Customer Documents
- Upload your CSV file
- Click Check Data (recommended)
- Click Import
Via CLI:
php bin/magento customerdocuments:import-customerdocuments /path/to/file.csvImport Behaviors
| Behavior | Description |
|---|---|
| Append / Add/Update | Create documents (no id) and update existing ones (with id). |
| Replace | Deletes the documents referenced by id in the CSV and re-imports them (useful for “replacing” a file/row). |
| Delete | Deletes the documents referenced by id in the CSV. |
Validation
Use Check Data in the Admin Import UI first. The importer validates:
- required fields (
name,description, andpathfor new docs) - customers (expects emails in
customer_ids) - customer groups (expects group codes in
customer_group_ids) - category (expects a category name in
category_id) product_linkssyntax (expectssku@store_code@positionentries separated by|)- file exists at the given
path - file extension allowed by
customerdocuments/general/allowed_extensions
Import Options
| Option | Description |
|---|---|
import_path | Required CLI argument (CSV file path) |
--behavior | append, add_update, replace, delete (default append) |
--field_separator | Field separator (default ,) |
--field_multiple_value_separator | Default , |
--fields_enclosure | Default 0 |
--delete_file_after_import | Delete CSV after import (default 1) |
Updating Without Changing Files
If you set id (existing document id), path is not required. This lets you update metadata (assignments, validity, tags, etc.) without re-uploading a file.
