Installation:
composer require akeneo/excel-init-bundle:3.0
Enable the bundle in config/bundles.php (or AppKernel.php for older Akeneo versions):
return [
// ...
Pim\Bundle\ExcelInitBundle\PimExcelInitBundle::class => ['all' => true],
];
Download the Template:
init.xlsx from the bundle’s fixtures:
vendor/akeneo/excel-init-bundle/src/Resources/fixtures/minimal/init.xlsx
config/import/ directory (create if missing).First Use Case:
init.xlsx in Microsoft Excel (not LibreOffice/OpenOffice).families, categories, attributes, channels, etc.) with your catalog structure.php bin/console pim:import:execute --env=prod --file=config/import/init.xlsx
init.xlsx structure (e.g., families sheet requires code, label, and channels columns).var/log/prod.log for errors during import.Catalog Initialization:
init.xlsx to define families, categories, attributes, channels, and locales upfront.family with code: "tshirts" and associate it with web_mobile channel.Incremental Updates:
category row to the categories sheet and re-run the import.Channel Management:
channels and families tabs).channels sheet to define channel types (e.g., ecommerce, mobile) and currencies.Attribute Groups:
attributes sheet using the family_variant column.code | type | family_variant
size | pim_catalog_identifier | tshirts
color| pim_catalog_text | tshirts
Locale Handling:
locales sheet (e.g., en_US, fr_FR).families/categories sheets for labels (e.g., label_en_US).Pre-Import Validation:
php bin/console pim:import:validate --env=prod --file=config/import/init.xlsx
Fix errors before executing the import.
Custom Templates:
init.xlsx template by copying it to config/import/custom_init.xlsx and modifying sheets.php bin/console pim:import:execute --file=config/import/custom_init.xlsx
Automate with CI:
Post-Import Actions:
php bin/console pim:product:assign-family --env=prod --family=tshirts --product=PRODUCT_SKU
Excel Compatibility:
Channel Name Mismatches:
web_mobile vs. web-mobile) will silently fail during family/category assignment.pim:import:validate to catch mismatches early.Missing Sheets:
families, categories, attributes, etc.). Missing sheets cause errors.Attribute Type Conflicts:
code (e.g., size) with different types (e.g., pim_catalog_text vs. pim_catalog_identifier) breaks imports.Locale Labels:
locales sheet (e.g., label_en_US for en_US).label_fr without fr_FR) will fail validation.Currency Mismatches:
USD, EUR). Define currencies in the channels sheet first.Dry Run:
php bin/console pim:import:execute --dry-run --file=config/import/init.xlsx
Simulates the import without changes.
Log Level:
Increase logging in config/packages/monolog.yaml:
handlers:
main:
level: debug
SQL Dumps: For complex issues, compare database states before/after import using:
mysqldump -uUSER -pPASS DATABASE > pre_import.sql
php bin/console pim:import:execute --file=init.xlsx
mysqldump -uUSER -pPASS DATABASE > post_import.sql
Custom Sheets:
init.xlsx and updating the importer (requires custom development).product_templates sheet for pre-defined product structures.Validation Rules:
Validator class (e.g., add custom rules for attribute values).src/Validator/ExcelInitValidator.php.Post-Import Scripts:
post_import event to trigger actions after import:
// config/services.yaml
Pim\Bundle\ExcelInitBundle\EventListener\PostImportListener:
tags:
- { name: kernel.event_listener, event: pim_enrich.post_import, method: onPostImport }
Fixtures Overrides:
init.xlsx with a custom version in config/import/ to enforce project-specific defaults.Backup Database: Always back up your database before running imports, especially in production.
Test Incrementally:
Start with a minimal init.xlsx (e.g., only families and channels), then expand.
Use Akeneo’s UI for Manual Fixes: For one-off corrections, use the Akeneo admin panel instead of re-importing entire sheets.
Version Alignment:
Ensure your akeneo/excel-init-bundle version matches your Akeneo PIM version (see requirements).
Performance:
For large catalogs, split the init.xlsx into multiple files (e.g., families.xlsx, attributes.xlsx) and import sequentially.
How can I help you explore Laravel packages today?