Data Import adds template-driven spreadsheet imports to Enso.
The package validates uploaded files against JSON template definitions, splits work into queued jobs, tracks import progress and status, generates rejected-row workbooks when needed, and exposes the API endpoints required by the Enso import UI.
It supports multi-sheet XLSX imports as well as CSV and TXT imports, with configurable structure validation, queue separation, and retention policies.
Install the package:
composer require laravel-enso/data-importRun the package migrations:
php artisan migrateOptional publishes:
php artisan vendor:publish --tag=data-import-config
php artisan vendor:publish --tag=data-import-factory
php artisan vendor:publish --tag=data-import-mail
php artisan vendor:publish --tag=data-import-examplesRegister at least one import type in config/enso/imports.php:
'configs' => [
'userGroups' => [
'label' => 'User Groups',
'template' => 'app/Imports/Templates/userGroups.json',
],
],The package schedules these maintenance commands daily:
enso:data-import:purgeenso:data-import:cancel-stuck
- Template-driven import definitions using JSON files.
- Queue-based splitting and processing for large imports.
- Support for
xlsx,csv, andtxtuploads. - Strict or flexible structure validation.
- Rejected-row report generation with an extra errors column.
- Downloadable import templates generated from the JSON definition.
Create an importer class that implements the package contract:
use LaravelEnso\DataImport\Contracts\Importable;
use LaravelEnso\DataImport\Models\Import;
use LaravelEnso\Helpers\Services\Obj;
class UserGroupImporter implements Importable
{
public function run(Obj $row, Import $import)
{
UserGroup::create($row->all());
}
}Point a template configuration entry to a JSON template that defines sheets, columns, and the importer class. The package can then:
- serve the generated template workbook
- validate uploaded files against the template
- queue the import when the structure is valid
POST api/import/storeDELETE api/import/{import}GET api/import/download/{import}GET api/import/initTableGET api/import/tableDataGET api/import/exportExcelPATCH api/import/{import}/cancelPATCH api/import/{import}/restartGET api/import/optionsGET api/import/{type}GET api/import/{type}/templateGET api/import/{rejected}/rejected
enso:data-import:purgeenso:data-import:cancel-stuck
ImportableBeforeHookAfterHookAuthenticatesAuthorizes
Required Enso packages:
laravel-enso/core↗laravel-enso/dynamic-methods↗laravel-enso/enums↗laravel-enso/excel↗laravel-enso/files↗laravel-enso/helpers↗laravel-enso/io↗laravel-enso/migrator↗laravel-enso/select↗laravel-enso/tables↗laravel-enso/track-who↗
Required external package:
Companion frontend package:
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!